packages feed

simpleconfig 0.0.8 → 0.0.9

raw patch · 3 files changed

+20/−44 lines, 3 files

Files

simpleconfig.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 9e43e9e0e4910e85544cfad73b0ac4cf0bad7cf6285499c4a46b05fcb3c6cea6+-- hash: 1f3e3450009bfd77e7430ed520edd3aa0c946c5dd117d5f40be0ee518511d9b5  name:           simpleconfig-version:        0.0.8+version:        0.0.9 synopsis:       Short description of your package description:    Please see the README on Github at <https://github.com/koterpillar/simpleconfig#readme> category:       Web
src/Config/Simple.hs view
@@ -4,7 +4,6 @@  Functions for declaring a configuration data type. -}- {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -22,7 +21,6 @@   , Complete   , LensFor(..)   , configLens-  , configLensPartial   , fromPartialConfig   ) where @@ -104,49 +102,30 @@ instance GFromPartialConfigMember (Last a) a where   gFromPartialConfigMember = getLast -configLens' ::-     forall config k proxy.+configLens ::+     forall config k.      ( Generic (config k)      , Generic (LensConfig k config)-     , GLensFor k (config k) (Rep (config k)) (Rep (LensConfig k config))+     , GLensFor (config k) (Rep (config k)) (Rep (LensConfig k config))      )-  => proxy k-  -> LensConfig k config-configLens' pk = G.to $ gToLensFor pk rootLens+  => LensConfig k config+configLens = G.to $ gToLensFor rootLens   where     rootLens ::          forall x. Generic (config k)       => Lens' (config k) (Rep (config k) x)     rootLens = G.generic -configLensPartial ::-     forall config proxy.-     ( Generic (config CPartial)-     , Generic (LensConfig CPartial config)-     , GLensFor CPartial (config CPartial) (Rep (config CPartial)) (Rep (LensConfig CPartial config))-     )-  => LensConfig CPartial config-configLensPartial = configLens' (Nothing :: Maybe CPartial)--configLens ::-     forall config proxy.-     ( Generic (config CComplete)-     , Generic (LensConfig CComplete config)-     , GLensFor CComplete (config CComplete) (Rep (config CComplete)) (Rep (LensConfig CComplete config))-     )-  => LensConfig CComplete config-configLens = configLens' (Nothing :: Maybe CComplete)--class GLensFor k root rep repLens where-  gToLensFor :: proxy k -> Lens' root (rep x) -> repLens x+class GLensFor root rep repLens where+  gToLensFor :: Lens' root (rep x) -> repLens x -instance GLensFor k root r rl => GLensFor k root (M1 i m r) (M1 i m rl) where-  gToLensFor pk rootLens = M1 $ gToLensFor pk (rootLens . G._M1)+instance GLensFor root r rl => GLensFor root (M1 i m r) (M1 i m rl) where+  gToLensFor rootLens = M1 $ gToLensFor (rootLens . G._M1) -instance (GLensFor k root ra ral, GLensFor k root rb rbl) =>-         GLensFor k root (ra :*: rb) (ral :*: rbl) where-  gToLensFor pk rootLens =-    gToLensFor pk (rootLens . _1) :*: gToLensFor pk (rootLens . _2)+instance (GLensFor root ra ral, GLensFor root rb rbl) =>+         GLensFor root (ra :*: rb) (ral :*: rbl) where+  gToLensFor rootLens =+    gToLensFor (rootLens . _1) :*: gToLensFor (rootLens . _2) -instance GLensFor k root (Rec0 x) (Rec0 (LensFor root x)) where-  gToLensFor pk rootLens = K1 $ LensFor $ rootLens . G._K1+instance GLensFor root (Rec0 x) (Rec0 (LensFor root x)) where+  gToLensFor rootLens = K1 $ LensFor $ rootLens . G._K1
test/Spec.hs view
@@ -41,9 +41,6 @@   mempty = memptydefault   mappend = mappenddefault -Config (LensFor address') (LensFor dryRun') (LensFor widgets') =-  configLensPartial- type Config = Complete ConfigF  deriving instance Eq Config@@ -55,9 +52,9 @@ main :: IO () main = do   let config' =-        mempty & (address' <>~ Last (Just "Silverpond")) & (dryRun' <>~ Any True) &-        (widgets' <>~ Set.singleton "blah") &-        (address' <>~ Last (Just "SEEK"))+        mempty & (address <>~ pure "Silverpond") & (dryRun <>~ Any True) &+        (widgets <>~ Set.singleton "blah") &+        (address <>~ pure "SEEK")   print config'   let (Just config) = fromPartialConfig config'   Text.putStrLn $ "Address = " <> config ^. address