nri-env-parser 0.1.0.3 → 0.1.0.4
raw patch · 4 files changed
+32/−32 lines, 4 filesdep ~nri-prelude
Dependency ranges changed: nri-prelude
Files
- CHANGELOG.md +4/−0
- LICENSE +1/−1
- nri-env-parser.cabal +6/−6
- src/Environment.hs +21/−25
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.1.0.4++- Relax version bounds to encompass `nri-prelude-0.4.0.0`.+ # 0.1.0.3 - Relax version bounds to encompass `nri-prelude-0.3.0.0`.
LICENSE view
@@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2020, NoRedInk+Copyright (c) 2021, NoRedInk All rights reserved. Redistribution and use in source and binary forms, with or without
nri-env-parser.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.2. -- -- see: https://github.com/sol/hpack ----- hash: 31adfc6f20549796404b6185801ed95d74e1e00899f843541f15c3871190cf82+-- hash: 484714e0aaf74c61be7ce233e5253fb0823a154d51e3158341e5cf9ede2d291f name: nri-env-parser-version: 0.1.0.3+version: 0.1.0.4 synopsis: Read environment variables as settings to build 12-factor apps. description: Please see the README at <https://github.com/NoRedInk/haskell-libraries/tree/trunk/env-parser>. category: Web@@ -15,7 +15,7 @@ bug-reports: https://github.com/NoRedInk/haskell-libraries/issues author: NoRedInk maintainer: haskell-open-source@noredink.com-copyright: 2020 NoRedInk Corp.+copyright: 2021 NoRedInk Corp. license: BSD3 license-file: LICENSE build-type: Simple@@ -37,11 +37,11 @@ hs-source-dirs: src default-extensions: DataKinds DeriveGeneric FlexibleContexts FlexibleInstances GeneralizedNewtypeDeriving MultiParamTypeClasses NamedFieldPuns NoImplicitPrelude OverloadedStrings PartialTypeSignatures ScopedTypeVariables Strict TypeOperators- ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns+ ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin build-depends: base >=4.12.0.0 && <4.15 , modern-uri >=0.3.1.0 && <0.4 , network-uri >=2.6.2.0 && <2.8- , nri-prelude >=0.1.0.0 && <0.4+ , nri-prelude >=0.1.0.0 && <0.5 , text >=1.2.3.1 && <1.3 default-language: Haskell2010
src/Environment.hs view
@@ -173,12 +173,11 @@ -- | An environment decoder knows how to read an app's configuration from -- environment variables. Check out the @variable@ function to see how you can -- begin building decoders.-data Decoder config- = Decoder- { -- | The list of @Variable@s that this decoder will read when ran.- consumes :: [Variable],- readFromEnvironment :: Dict.Dict Text Text -> Result [ParseError] config- }+data Decoder config = Decoder+ { -- | The list of @Variable@s that this decoder will read when ran.+ consumes :: [Variable],+ readFromEnvironment :: Dict.Dict Text Text -> Result [ParseError] config+ } deriving (Functor) instance Applicative Decoder where@@ -206,30 +205,27 @@ fr <*> xr -- | An environment variable with a description of what it is used for.-data Variable- = Variable- { name :: Text,- description :: Text,- defaultValue :: Text- }+data Variable = Variable+ { name :: Text,+ description :: Text,+ defaultValue :: Text+ } deriving (Show) -data ParseError- = ParseError- { failingVariable :: Variable,- failingReason :: Text- }+data ParseError = ParseError+ { failingVariable :: Variable,+ failingReason :: Text+ } deriving (Show) -- | Describe a decoded variable for informational purposes.-data DecodedVariable- = DecodedVariable- { decodedVariable :: Variable,- decodedCurrent :: Maybe Text,- -- A single environment variable can be decoded by multiple decoders,- -- each with their own constraints.- decodedErrors :: List Text- }+data DecodedVariable = DecodedVariable+ { decodedVariable :: Variable,+ decodedCurrent :: Maybe Text,+ -- A single environment variable can be decoded by multiple decoders,+ -- each with their own constraints.+ decodedErrors :: List Text+ } deriving (Show) -- | Produce a configuration from a single environment veriable. Usually you