simpleconfig 0.0.5 → 0.0.7
raw patch · 3 files changed
+27/−46 lines, 3 files
Files
- simpleconfig.cabal +21/−21
- src/Config/Simple.hs +5/−24
- test/Spec.hs +1/−1
simpleconfig.cabal view
@@ -2,22 +2,22 @@ -- -- see: https://github.com/sol/hpack ----- hash: c67d10d1eb1bf920ba6216f194f8ebecca2f446b5969afddc4dcac33138a7283+-- hash: 3f050daea80c2a4761388510e8f040afc3d6da8bcd373506b06e534380dbfb43 -name: simpleconfig-version: 0.0.5-synopsis: Short description of your package-homepage: https://github.com/koterpillar/simpleconfig#readme-bug-reports: https://github.com/koterpillar/simpleconfig/issues-license: BSD3-license-file: LICENSE-author: Alexey Kotlyarov-maintainer: a@koterpillar.com-copyright: 2017 Alexey Kotlyarov-category: Web-build-type: Simple-cabal-version: >= 1.10-description: Please see the README on Github at <https://github.com/koterpillar/simpleconfig#readme>+name: simpleconfig+version: 0.0.7+synopsis: Short description of your package+description: Please see the README on Github at <https://github.com/koterpillar/simpleconfig#readme>+category: Web+homepage: https://github.com/koterpillar/simpleconfig#readme+bug-reports: https://github.com/koterpillar/simpleconfig/issues+author: Alexey Kotlyarov+maintainer: a@koterpillar.com+copyright: 2017 Alexey Kotlyarov+license: BSD3+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10 extra-source-files: README.md@@ -29,21 +29,22 @@ library hs-source-dirs: src- exposed-modules:- Config.Simple- other-modules:- Paths_simpleconfig build-depends: base >=4.7 && <5 , containers , lens+ exposed-modules:+ Config.Simple+ other-modules:+ Paths_simpleconfig default-language: Haskell2010 test-suite simpleconfig-test type: exitcode-stdio-1.0+ main-is: Spec.hs hs-source-dirs: test- main-is: Spec.hs+ ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: base , containers@@ -53,5 +54,4 @@ , text other-modules: Paths_simpleconfig- ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010
src/Config/Simple.hs view
@@ -49,20 +49,17 @@ type family ConfigLast a k where ConfigLast a CPartial = Last a ConfigLast a CComplete = a- ConfigLast a (CLensFor CPartial root) = LensFor root (Last a)- ConfigLast a (CLensFor CComplete root) = LensFor root a+ ConfigLast a (CLensFor k root) = LensFor root (ConfigLast a k) type family ConfigBool k where ConfigBool CPartial = Any ConfigBool CComplete = Bool- ConfigBool (CLensFor CPartial root) = LensFor root Bool- ConfigBool (CLensFor CComplete root) = LensFor root Bool+ ConfigBool (CLensFor k root) = LensFor root (ConfigBool k) type family ConfigSet a k where ConfigSet a CPartial = Set a ConfigSet a CComplete = Set a- ConfigSet a (CLensFor CPartial root) = LensFor root (Set a)- ConfigSet a (CLensFor CComplete root) = LensFor root (Set a)+ ConfigSet a (CLensFor k root) = LensFor root (ConfigSet a k) type Partial config = config CPartial @@ -151,21 +148,5 @@ gToLensFor pk rootLens = gToLensFor pk (rootLens . _1) :*: gToLensFor pk (rootLens . _2) -instance GLensForMember k x y =>- GLensFor k root (Rec0 x) (Rec0 (LensFor root y)) where- gToLensFor pk rootLens = K1 $ LensFor $ rootLens . G._K1 . gLensLeaf pk--class GLensForMember k x y where- gLensLeaf :: proxy k -> Lens' x y--instance GLensForMember CPartial (Last a) (Last a) where- gLensLeaf _ = id--instance GLensForMember CPartial Any Bool where- gLensLeaf _ = iso getAny Any--instance GLensForMember CPartial (Set a) (Set a) where- gLensLeaf _ = id--instance GLensForMember CComplete a a where- gLensLeaf _ = id+instance GLensFor k root (Rec0 x) (Rec0 (LensFor root x)) where+ gToLensFor pk rootLens = K1 $ LensFor $ rootLens . G._K1
test/Spec.hs view
@@ -55,7 +55,7 @@ main :: IO () main = do let config' =- mempty & (address' <>~ Last (Just "Silverpond")) & (dryRun' .~ True) &+ mempty & (address' <>~ Last (Just "Silverpond")) & (dryRun' <>~ Any True) & (widgets' <>~ Set.singleton "blah") & (address' <>~ Last (Just "SEEK")) print config'