registry 0.1.6.0 → 0.1.6.1
raw patch · 2 files changed
+13/−2 lines, 2 files
Files
- registry.cabal +2/−2
- src/Data/Registry/State.hs +11/−0
registry.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 9d1d96e730c89433825e01a4a94a2efa05f6d8ae2d3de62e5357c26e04c73dd9+-- hash: b2a9bd3b890c2e666f472cab045fa0e78cb9e7663a6fbbac1a2417d264d3b534 name: registry-version: 0.1.6.0+version: 0.1.6.1 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/State.hs view
@@ -57,6 +57,10 @@ addToRegistry (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) = Registry (Values vs) (Functions (f : fs)) specializations modifiers +-- | Concatenate a registry to another statefully (to be used with $(makeGenerators ''MyType))+concatUnsafeS :: (MonadState (Registry ins out) m) => Registry ins' out' -> m ()+concatUnsafeS r = modify (concatRegistryUnsafe r)+ -- | Register modifications of the registry without changing its type addToRegistryUnsafe :: (Typeable a) => Typed a -> Registry ins out -> Registry ins out addToRegistryUnsafe (TypedValue v) (Registry (Values vs) functions specializations modifiers) =@@ -64,3 +68,10 @@ addToRegistryUnsafe (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) = Registry (Values vs) (Functions (f : fs)) specializations modifiers++-- | Concatenate 2 registries+concatRegistryUnsafe :: Registry ins out -> Registry ins' out' -> Registry ins' out'+concatRegistryUnsafe+ (Registry (Values vs1) (Functions fs1) (Specializations ss1) (Modifiers ms1))+ (Registry (Values vs2) (Functions fs2) (Specializations ss2) (Modifiers ms2)) =+ Registry (Values (vs1 <> vs2)) (Functions (fs1 <> fs2)) (Specializations (ss1 <> ss2)) (Modifiers (ms1 <> ms2))