packages feed

registry 0.3.0.5 → 0.3.0.6

raw patch · 3 files changed

+39/−12 lines, 3 files

Files

registry.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 8f088229b02c37ae05a8267381fa377432e06918f7a865c2ddc0443407d2476c+-- hash: 7d277b144f2e796aef40e1f0297fedd7ee3d0fea65479dcc0544572897ec4b44  name:           registry-version:        0.3.0.5+version:        0.3.0.6 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
@@ -155,6 +155,33 @@   where   (<:) a b = register a (register b end) +-- Unchecked unification of +: and <+>+infixr 5 <+++class AddRegistryUncheckedLike a b c | a b -> c where+  (<+) :: a -> b -> c++instance (insr ~ (ins1 :++ ins2), outr ~ (out1 :++ out2)) => AddRegistryUncheckedLike (Registry ins1 out1) (Registry ins2 out2) (Registry insr outr) where+  (<+) = (<+>)++instance+  (Typeable a, insr ~ (Inputs a :++ ins2), outr ~ (Output a : out2)) =>+  AddRegistryUncheckedLike (Typed a) (Registry ins2 out2) (Registry insr outr)+  where+  (<+) = registerUnchecked++instance+  (Typeable a, insr ~ (Inputs a :++ ins2), outr ~ (Output a : out2)) =>+  AddRegistryUncheckedLike (Registry ins2 out2) (Typed a) (Registry insr outr)+  where+  (<+) = flip registerUnchecked++instance+  (Typeable a, Typeable b, insr ~ (Inputs a :++ (Inputs b :++ '[])), outr ~ (Output a : '[Output b])) =>+  AddRegistryUncheckedLike (Typed a) (Typed b) (Registry insr outr)+  where+  (<+) a b = registerUnchecked a (registerUnchecked 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/GenSpec.hs view
@@ -76,16 +76,16 @@ -- | Create a registry for all generators registry =   funTo @Gen Company-    <: fun (genList @Department)-    <: funTo @Gen Department-    <: fun (genList @Employee)-    <: funTo @Gen Employee-    <: funTo @Gen Age-    <: funTo @Gen Fixed-    <: funTo @Gen Name-    <: fun genInt-    <: fun genText-    <: fun genDouble+    <+ fun (genList @Department)+    <+ funTo @Gen Department+    <+ fun (genList @Employee)+    <+ funTo @Gen Employee+    <+ funTo @Gen Age+    <+ funTo @Gen Fixed+    <+ funTo @Gen Name+    <+ fun genInt+    <+ fun genText+    <+ fun genDouble  test_company_with_one_employee = noShrink $   prop "generate just one employee" $