registry 0.1.4.1 → 0.1.4.2
raw patch · 3 files changed
+30/−2 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Registry.Registry: (<:) :: AddRegistryLike a b c => a -> b -> c
+ Data.Registry.Registry: class AddRegistryLike a b c | a b -> c
+ Data.Registry.Registry: instance (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b, insr Data.Type.Equality.~ (Data.Registry.Solver.Inputs a Data.Registry.Solver.:++ (Data.Registry.Solver.Inputs b Data.Registry.Solver.:++ '[])), outr Data.Type.Equality.~ '[Data.Registry.Solver.Output a, Data.Registry.Solver.Output b]) => Data.Registry.Registry.AddRegistryLike (Data.Registry.Internal.Types.Typed a) (Data.Registry.Internal.Types.Typed b) (Data.Registry.Registry.Registry insr outr)
+ Data.Registry.Registry: instance (Data.Typeable.Internal.Typeable a, insr Data.Type.Equality.~ (Data.Registry.Solver.Inputs a Data.Registry.Solver.:++ ins2), outr Data.Type.Equality.~ (Data.Registry.Solver.Output a : out2)) => Data.Registry.Registry.AddRegistryLike (Data.Registry.Internal.Types.Typed a) (Data.Registry.Registry.Registry ins2 out2) (Data.Registry.Registry.Registry insr outr)
+ Data.Registry.Registry: instance (Data.Typeable.Internal.Typeable a, insr Data.Type.Equality.~ (Data.Registry.Solver.Inputs a Data.Registry.Solver.:++ ins2), outr Data.Type.Equality.~ (Data.Registry.Solver.Output a : out2)) => Data.Registry.Registry.AddRegistryLike (Data.Registry.Registry.Registry ins2 out2) (Data.Registry.Internal.Types.Typed a) (Data.Registry.Registry.Registry insr outr)
+ Data.Registry.Registry: instance (insr Data.Type.Equality.~ (ins1 Data.Registry.Solver.:++ ins2), outr Data.Type.Equality.~ (out1 Data.Registry.Solver.:++ out2)) => Data.Registry.Registry.AddRegistryLike (Data.Registry.Registry.Registry ins1 out1) (Data.Registry.Registry.Registry ins2 out2) (Data.Registry.Registry.Registry insr outr)
- Data.Registry.Registry: infixr 5 +:
+ Data.Registry.Registry: infixr 5 <:
Files
- registry.cabal +2/−2
- src/Data/Registry/Registry.hs +17/−0
- test/Test/Data/Registry/RegistrySpec.hs +11/−0
registry.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 93391393725500559fd1f61542de85c5032805123e2e8422cf22ef4b5a4ceb78+-- hash: a3a005241afd4b08ed13cc92e9a95d3df783d9fd0e7cc884b0f9235f388ffe6c name: registry-version: 0.1.4.1+version: 0.1.4.2 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.
src/Data/Registry/Registry.hs view
@@ -104,6 +104,23 @@ (+:) :: (Typeable a) => Typed a -> Registry ins out -> Registry (Inputs a :++ ins) (Output a ': out) (+:) = register +-- Unification of +: and <+>+infixr 5 <:+class AddRegistryLike a b c | a b -> c where+ (<:) :: a -> b -> c++instance (insr ~ (ins1 :++ ins2), outr ~ (out1 :++ out2)) => AddRegistryLike (Registry ins1 out1) (Registry ins2 out2) (Registry insr outr) where+ (<:) = (<+>)++instance (Typeable a, insr ~ (Inputs a :++ ins2), outr ~ (Output a : out2)) => AddRegistryLike (Typed a) (Registry ins2 out2) (Registry insr outr) where+ (<:) = register++instance (Typeable a, insr ~ (Inputs a :++ ins2), outr ~ (Output a : out2)) => AddRegistryLike (Registry ins2 out2) (Typed a) (Registry insr outr) where+ (<:) = flip register++instance (Typeable a, Typeable b, insr ~ (Inputs a :++ (Inputs b :++ '[])), outr ~ (Output a : '[Output b])) => AddRegistryLike (Typed a) (Typed b) (Registry insr outr) where+ (<:) a b = register a (register b end)+ -- | Make the lists of types in the Registry unique, either for better display -- or for faster compile-time resolution with the make function normalize :: Registry ins out -> Registry (Normalized ins) (Normalized out)
test/Test/Data/Registry/RegistrySpec.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}@@ -34,3 +35,13 @@ registry = fun newLogger +: end+++-- * COMPILATION CHECK WITH THE <: operator++registry1 :: Registry '[] '[Int, Text]+registry1 = normalize $+ (val (1::Int))+ <: (val ("t"::Text) +: end)+ <: (val ("t"::Text) +: end)+ <: val ("t"::Text)