registry 0.1.5.5 → 0.1.6.0
raw patch · 2 files changed
+16/−44 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Registry.State: addFun' :: (Typeable a, IsSubset (Inputs a) ins) => a -> Registry ins out -> Registry ins out
- Data.Registry.State: addFunS' :: (Typeable a, IsSubset (Inputs a) ins, MonadState (Registry ins out) m) => a -> m ()
- Data.Registry.State: addFunTo' :: forall m a b ins out. (ApplyVariadic m a b, Typeable a, Typeable b, IsSubset (Inputs b) ins) => a -> Registry ins out -> Registry ins out
- Data.Registry.State: addToS' :: forall n a b m ins out. (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, IsSubset (Inputs b) ins, MonadState (Registry ins out) m) => a -> m ()
- Data.Registry.State: modifyRegistry :: (Typeable a, IsSubset (Inputs a) ins, Contains (Output a) out) => Typed a -> Registry ins out -> Registry ins out
- Data.Registry.State: modifyRegistry' :: (Typeable a, IsSubset (Inputs a) ins) => Typed a -> Registry ins out -> Registry ins out
- Data.Registry.State: modifyRegistryUnsafe :: Typeable a => Typed a -> Registry ins out -> Registry ins out
+ Data.Registry.State: addToRegistry :: (Typeable a, IsSubset (Inputs a) out) => Typed a -> Registry ins out -> Registry ins out
+ Data.Registry.State: addToRegistryUnsafe :: Typeable a => Typed a -> Registry ins out -> Registry ins out
- Data.Registry.State: addFun :: (Typeable a, IsSubset (Inputs a) ins, Contains (Output a) out) => a -> Registry ins out -> Registry ins out
+ Data.Registry.State: addFun :: (Typeable a, IsSubset (Inputs a) out) => a -> Registry ins out -> Registry ins out
- Data.Registry.State: addFunS :: (Typeable a, IsSubset (Inputs a) ins, Contains (Output a) out, MonadState (Registry ins out) m) => a -> m ()
+ Data.Registry.State: addFunS :: (Typeable a, IsSubset (Inputs a) out, MonadState (Registry ins out) m) => a -> m ()
- Data.Registry.State: addFunTo :: forall m a b ins out. (ApplyVariadic m a b, Typeable a, Typeable b, IsSubset (Inputs b) ins, Contains (Output b) out) => a -> Registry ins out -> Registry ins out
+ Data.Registry.State: addFunTo :: forall m a b ins out. (ApplyVariadic m a b, Typeable a, Typeable b, IsSubset (Inputs b) out) => a -> Registry ins out -> Registry ins out
- Data.Registry.State: addToS :: forall n a b m ins out. (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, IsSubset (Inputs b) ins, Contains (Output b) out, MonadState (Registry ins out) m) => a -> m ()
+ Data.Registry.State: addToS :: forall n a b m ins out. (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, IsSubset (Inputs b) out, MonadState (Registry ins out) m) => a -> m ()
Files
- registry.cabal +2/−2
- src/Data/Registry/State.hs +14/−42
registry.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 11d110cf6c7454893e5841b49f0b4c472673b9ca74f0cd2f90183bc3b9aaf379+-- hash: 9d1d96e730c89433825e01a4a94a2efa05f6d8ae2d3de62e5357c26e04c73dd9 name: registry-version: 0.1.5.5+version: 0.1.6.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.
src/Data/Registry/State.hs view
@@ -14,81 +14,53 @@ runS r = hoist (`evalStateT` r) -- | Add an element to the registry without changing its type-addFunTo :: forall m a b ins out . (ApplyVariadic m a b, Typeable a, Typeable b, IsSubset (Inputs b) ins, Contains (Output b) out) => a -> Registry ins out -> Registry ins out-addFunTo = modifyRegistry @b . funTo @m---- | Add an element to the registry without changing its type--- *** This possibly adds untracked output type! ***-addFunTo' :: forall m a b ins out . (ApplyVariadic m a b, Typeable a, Typeable b, IsSubset (Inputs b) ins) => a -> Registry ins out -> Registry ins out-addFunTo' = modifyRegistry' @b . funTo @m+addFunTo :: forall m a b ins out . (ApplyVariadic m a b, Typeable a, Typeable b, IsSubset (Inputs b) out) => a -> Registry ins out -> Registry ins out+addFunTo = addToRegistry @b . funTo @m -- | Add an element to the registry without changing its type -- *** This possibly adds untracked input types / output type! *** addFunToUnsafe :: forall m a b ins out . (ApplyVariadic m a b, Typeable a, Typeable b) => a -> Registry ins out -> Registry ins out-addFunToUnsafe = modifyRegistryUnsafe @b . funTo @m+addFunToUnsafe = addToRegistryUnsafe @b . funTo @m -- | Add an element to the registry without changing its type, in the State monad-addFunS :: (Typeable a, IsSubset (Inputs a) ins, Contains (Output a) out, MonadState (Registry ins out) m) => a -> m ()+addFunS :: (Typeable a, IsSubset (Inputs a) out, MonadState (Registry ins out) m) => a -> m () addFunS = modify . addFun -- | Add an element to the registry without changing its type, in the State monad--- *** This possibly adds untracked output type! ***-addFunS' :: (Typeable a, IsSubset (Inputs a) ins, MonadState (Registry ins out) m) => a -> m ()-addFunS' = modify . addFun'---- | Add an element to the registry without changing its type, in the State monad -- *** This possibly adds untracked input types / output type! *** addFunUnsafeS :: (Typeable a, MonadState (Registry ins out) m) => a -> m () addFunUnsafeS = modify . addFunUnsafe -- | Add an element to the registry without changing its type, in the State monad-addToS :: forall n a b m ins out . (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, IsSubset (Inputs b) ins, Contains (Output b) out, MonadState (Registry ins out) m) => a -> m ()+addToS :: forall n a b m ins out . (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, IsSubset (Inputs b) out, MonadState (Registry ins out) m) => a -> m () addToS = modify . addFunTo @n @a @b -- | Add an element to the registry without changing its type, in the State monad--- *** This possibly adds untracked output type! ***-addToS' :: forall n a b m ins out . (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, IsSubset (Inputs b) ins, MonadState (Registry ins out) m) => a -> m ()-addToS' = modify . addFunTo' @n @a @b---- | Add an element to the registry without changing its type, in the State monad -- *** This possibly adds untracked input types / output type! *** addToUnsafeS :: forall n a b m ins out . (ApplyVariadic n a b, Typeable a, Typeable b, Typeable a, MonadState (Registry ins out) m) => a -> m () addToUnsafeS = modify . addFunToUnsafe @n @a @b -- | Add an element to the registry without changing its type-addFun :: (Typeable a, IsSubset (Inputs a) ins, Contains (Output a) out) => a -> Registry ins out -> Registry ins out-addFun = modifyRegistry . fun---- | Add an element to the registry without changing its type--- *** This possibly adds untracked output type! ***-addFun' :: (Typeable a, IsSubset (Inputs a) ins) => a -> Registry ins out -> Registry ins out-addFun' = modifyRegistry' . fun+addFun :: (Typeable a, IsSubset (Inputs a) out) => a -> Registry ins out -> Registry ins out+addFun = addToRegistry . fun -- | Add an element to the registry without changing its type -- *** This possibly adds untracked input types / output type! *** addFunUnsafe :: (Typeable a) => a -> Registry ins out -> Registry ins out-addFunUnsafe = modifyRegistryUnsafe . fun+addFunUnsafe = addToRegistryUnsafe . fun -- | Register modifications of elements which types are already in the registry-modifyRegistry :: (Typeable a, IsSubset (Inputs a) ins, Contains (Output a) out) => Typed a -> Registry ins out -> Registry ins out-modifyRegistry (TypedValue v) (Registry (Values vs) functions specializations modifiers) =- Registry (Values (v : vs)) functions specializations modifiers--modifyRegistry (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) =- Registry (Values vs) (Functions (f : fs)) specializations modifiers---- | Register modifications of elements for which only the input types are in the registry-modifyRegistry' :: (Typeable a, IsSubset (Inputs a) ins) => Typed a -> Registry ins out -> Registry ins out-modifyRegistry' (TypedValue v) (Registry (Values vs) functions specializations modifiers) =+addToRegistry :: (Typeable a, IsSubset (Inputs a) out) => Typed a -> Registry ins out -> Registry ins out+addToRegistry (TypedValue v) (Registry (Values vs) functions specializations modifiers) = Registry (Values (v : vs)) functions specializations modifiers -modifyRegistry' (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) =+addToRegistry (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) = Registry (Values vs) (Functions (f : fs)) specializations modifiers -- | Register modifications of the registry without changing its type-modifyRegistryUnsafe :: (Typeable a) => Typed a -> Registry ins out -> Registry ins out-modifyRegistryUnsafe (TypedValue v) (Registry (Values vs) functions specializations modifiers) =+addToRegistryUnsafe :: (Typeable a) => Typed a -> Registry ins out -> Registry ins out+addToRegistryUnsafe (TypedValue v) (Registry (Values vs) functions specializations modifiers) = Registry (Values (v : vs)) functions specializations modifiers -modifyRegistryUnsafe (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) =+addToRegistryUnsafe (TypedFunction f) (Registry (Values vs) (Functions fs) specializations modifiers) = Registry (Values vs) (Functions (f : fs)) specializations modifiers