registry 0.1.8.0 → 0.1.9.0
raw patch · 7 files changed
+34/−18 lines, 7 filesdep ~protolude
Dependency ranges changed: protolude
Files
- registry.cabal +4/−4
- src/Data/Registry/Internal/Make.hs +2/−2
- src/Data/Registry/Internal/Reflection.hs +12/−7
- src/Data/Registry/TH.hs +1/−1
- src/Data/Registry/Warmup.hs +5/−0
- test/Test/Data/Registry/Internal/TypesSpec.hs +7/−1
- test/Test/Data/Registry/MonadRandomSpec.hs +3/−3
registry.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 61a4e6dd8d565ecee4d2630089a265c4aaaea174f31300a45e261996c34d5747+-- hash: f62fea26e4a94d61ae114fa4ed0dc7b12a90b5696c293f12cfea0ad413302ad3 name: registry-version: 0.1.8.0+version: 0.1.9.0 synopsis: data structure for assembling components description: This library provides a "Registry" which is a data structure containing a list of functions and values representing dependencies in a directed acyclic graph. A `make` function can then be used to create a value of a specific type out of the registry. You can start with the [README](https://github.com/etorreborre/registry/blob/master/README.md) for a full description of the library.@@ -56,7 +56,7 @@ , hashable >=1.2 && <1.4 , mmorph >=1.0 && <2 , mtl >=2.0 && <3- , protolude >=0.2 && <0.3+ , protolude >=0.2 && <0.4 , resourcet >=1.1 && <1.3 , semigroupoids >=5.0 && <5.4 , semigroups >=0.15 && <0.20@@ -121,7 +121,7 @@ , mmorph >=1.0 && <2 , mtl >=2.0 && <3 , multimap <1.3- , protolude >=0.2 && <0.3+ , protolude >=0.2 && <0.4 , random <2.0 , registry , resourcet >=1.1 && <1.3
src/Data/Registry/Internal/Make.hs view
@@ -15,7 +15,7 @@ -} module Data.Registry.Internal.Make where -import Data.List hiding (unlines)+import qualified Data.List as L hiding (unlines) import Data.Registry.Internal.Dynamic import Data.Registry.Internal.Reflection (showSingleType) import Data.Registry.Internal.Registry@@ -62,7 +62,7 @@ then -- report an error if we cannot make enough input parameters to apply the function let madeInputTypes = fmap valueDynTypeRep inputs- missingInputTypes = inputTypes \\ madeInputTypes+ missingInputTypes = inputTypes L.\\ madeInputTypes in lift $ Left $ unlines
src/Data/Registry/Internal/Reflection.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE PolyKinds #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE TypeInType #-} {- |@@ -10,7 +11,11 @@ import Data.Semigroup import Data.Text as T import Data.Typeable (splitTyConApp)+#if MIN_VERSION_GLASGOW_HASKELL(8,10,1,0)+import Protolude as P hiding (intercalate, TypeRep, isPrefixOf, (<>), typeOf)+#else import Protolude as P hiding (intercalate, TypeRep, isPrefixOf, (<>))+#endif import Type.Reflection import GHC.Exts @@ -35,12 +40,12 @@ showTheFullValueType :: forall (r1 :: RuntimeRep) (arg :: TYPE r1) . (TypeRep arg -> Text) showTheFullValueType a = case a of- Fun t1 t2 ->- showTheFullValueType t1 <> " -> " <> showTheFullValueType t2- Fun (App t1 t2) t3 -> showNested (SomeTypeRep t1) (SomeTypeRep t2) <> " -> " <> showTheFullValueType t3 + Fun t1 t2 ->+ showTheFullValueType t1 <> " -> " <> showTheFullValueType t2+ App t1 t2 -> showNested (SomeTypeRep t1) (SomeTypeRep t2) @@ -53,14 +58,14 @@ showTheFullFunctionType :: forall (r1 :: RuntimeRep) (arg :: TYPE r1) . (TypeRep arg -> ([Text], Text)) showTheFullFunctionType a = case a of+ Fun (App t1 t2) t3 ->+ let (ins, out) = showTheFullFunctionType t3+ in (showNested (SomeTypeRep t1) (SomeTypeRep t2) : ins, out)+ Fun t1 t2 -> let in1 = showTheFullValueType t1 (ins, out) = showTheFullFunctionType t2 in (in1 : ins, out)-- Fun (App t1 t2) t3 ->- let (ins, out) = showTheFullFunctionType t3- in (showNested (SomeTypeRep t1) (SomeTypeRep t2) : ins, out) App t1 t2 -> ([], showNested (SomeTypeRep t1) (SomeTypeRep t2))
src/Data/Registry/TH.hs view
@@ -17,7 +17,7 @@ import Language.Haskell.TH import Language.Haskell.TH.Syntax import Prelude (String)-import Protolude hiding (Strict, Type)+import Protolude hiding (Type) {- This module generates a typeclass for a given "record of functions". For this component:
src/Data/Registry/Warmup.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE CPP #-} {- | This module contains data structures to describe the@@ -16,8 +17,12 @@ import qualified Control.Monad.Catch as Catch import Data.Semigroup ((<>))+#if MIN_VERSION_GLASGOW_HASKELL(8,10,1,0) import Protolude as P hiding ((<>))+#else+import Protolude as P hiding ((<>)) import Data.Typeable+#endif -- | A list of actions to run at startup newtype Warmup =
test/Test/Data/Registry/Internal/TypesSpec.hs view
@@ -1,10 +1,16 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} module Test.Data.Registry.Internal.TypesSpec where import Data.List.NonEmpty import Data.Registry.Internal.Types-import Protolude as P+#if MIN_VERSION_GLASGOW_HASKELL(8,10,1,0)+import Protolude as P hiding (typeOf)+#else+import Protolude as P+#endif+ import Test.Tasty.Extensions import Type.Reflection
test/Test/Data/Registry/MonadRandomSpec.hs view
@@ -15,7 +15,7 @@ import Control.Monad.Random.Class as R import Control.Monad.Trans.Random.Lazy import Data.IORef-import Data.List+import qualified Data.List as L import Data.Registry import Protolude as P import System.Random as R@@ -97,7 +97,7 @@ annotateShow results -- if we call the generator several times we should get at least 2 different values- assert (length (nub results) > 2)+ assert (length (L.nub results) > 2) test_client_function_with_seeded_values = test "a function using MonadRandom can be executed with the RandomGenerator component and return predetermined values" $ do let registry' =@@ -123,4 +123,4 @@ annotateShow results -- everytime we call the generator we get the same value- length (nub results) === 1+ length (L.nub results) === 1