packages feed

dep-t-dynamic 0.1.0.0 → 0.1.0.1

raw patch · 6 files changed

+42/−43 lines, 6 filesdep ~algebraic-graphsdep ~dep-tdep ~doctestPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: algebraic-graphs, dep-t, doctest, hashable, microlens, mtl, transformers, unliftio-core

API changes (from Hackage documentation)

- Dep.Checked: instance GHC.Base.Monoid (Dep.Checked.CheckedEnv phases me_ m)
- Dep.Checked: instance GHC.Base.Semigroup (Dep.Checked.CheckedEnv phases me_ m)
- Dep.SimpleChecked: instance GHC.Base.Monoid (Dep.SimpleChecked.CheckedEnv phases m)
- Dep.SimpleChecked: instance GHC.Base.Semigroup (Dep.SimpleChecked.CheckedEnv phases m)
+ Dep.Checked: instance GHC.Base.Monoid (Dep.Checked.CheckedEnv h me_ m)
+ Dep.Checked: instance GHC.Base.Semigroup (Dep.Checked.CheckedEnv h me_ m)
+ Dep.SimpleChecked: instance GHC.Base.Monoid (Dep.SimpleChecked.CheckedEnv h m)
+ Dep.SimpleChecked: instance GHC.Base.Semigroup (Dep.SimpleChecked.CheckedEnv h m)
- Dep.Checked: checkEnv :: CheckedEnv phases me_ m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv phases (DepT me_ m))
+ Dep.Checked: checkEnv :: CheckedEnv h me_ m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv h (DepT me_ m))
- Dep.Checked: checkedDep :: forall r_ rs mcs phases me_ m. (All Typeable rs, All Typeable mcs, Typeable r_, Typeable phases, Typeable me_, Typeable m, HasAll rs (DepT me_ m) (me_ (DepT me_ m)), forall s_ z n. Has s_ n (DynamicEnv Identity n) => Has s_ n (me_ n), Monad m, MonadSatisfiesAll mcs (DepT me_ m)) => (forall e_ n. (HasAll rs (DepT e_ n) (e_ (DepT e_ n)), Monad n, MonadSatisfiesAll mcs (DepT e_ n)) => phases (r_ (DepT e_ n))) -> CheckedEnv phases me_ m -> CheckedEnv phases me_ m
+ Dep.Checked: checkedDep :: forall r_ rs mcs h me_ m. (All Typeable rs, All Typeable mcs, Typeable r_, Typeable h, Typeable me_, Typeable m, HasAll rs (DepT me_ m) (me_ (DepT me_ m)), forall s_ z n. Has s_ n (DynamicEnv Identity n) => Has s_ n (me_ n), Monad m, MonadSatisfiesAll mcs (DepT me_ m)) => (forall e_ n. (HasAll rs (DepT e_ n) (e_ (DepT e_ n)), Monad n, MonadSatisfiesAll mcs (DepT e_ n)) => h (r_ (DepT e_ n))) -> CheckedEnv h me_ m -> CheckedEnv h me_ m
- Dep.Checked: data CheckedEnv phases me_ m
+ Dep.Checked: data CheckedEnv h me_ m
- Dep.Checked: getUnchecked :: CheckedEnv phases me_ m -> (DepGraph, DynamicEnv phases (DepT me_ m))
+ Dep.Checked: getUnchecked :: CheckedEnv h me_ m -> (DepGraph, DynamicEnv h (DepT me_ m))
- Dep.SimpleChecked: checkEnv :: CheckedEnv phases m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv (phases `Compose` Constructor (DynamicEnv Identity m)) m)
+ Dep.SimpleChecked: checkEnv :: CheckedEnv h m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv (h `Compose` Constructor (DynamicEnv Identity m)) m)
- Dep.SimpleChecked: checkedDep :: forall r_ rs mcs phases m. (All Typeable rs, All Typeable mcs, Typeable r_, Typeable phases, Typeable m, HasAll rs m (DynamicEnv Identity m), Monad m, MonadSatisfiesAll mcs m) => (forall e n. (HasAll rs n e, Monad m, MonadSatisfiesAll mcs n) => (phases `Compose` Constructor e) (r_ n)) -> CheckedEnv phases m -> CheckedEnv phases m
+ Dep.SimpleChecked: checkedDep :: forall r_ rs mcs h m. (All Typeable rs, All Typeable mcs, Typeable r_, Typeable h, Typeable m, HasAll rs m (DynamicEnv Identity m), Monad m, MonadSatisfiesAll mcs m) => (forall e n. (HasAll rs n e, Monad m, MonadSatisfiesAll mcs n) => (h `Compose` Constructor e) (r_ n)) -> CheckedEnv h m -> CheckedEnv h m
- Dep.SimpleChecked: data CheckedEnv phases m
+ Dep.SimpleChecked: data CheckedEnv h m
- Dep.SimpleChecked: getUnchecked :: CheckedEnv phases m -> (DepGraph, DynamicEnv (phases `Compose` Constructor (DynamicEnv Identity m)) m)
+ Dep.SimpleChecked: getUnchecked :: CheckedEnv h m -> (DepGraph, DynamicEnv (h `Compose` Constructor (DynamicEnv Identity m)) m)

Files

CHANGELOG.md view
@@ -1,5 +1,5 @@-# Revision history for dep-t
+# Revision history for dep-t-dynamic
 
-## 0.5.0.0
+## 0.1.0.1
 
-* First version. Released on an unsuspecting world.
+* Works with algebraic-graphs 0.6.
dep-t-dynamic.cabal view
@@ -1,7 +1,7 @@ cabal-version:       3.0
 
 name:                dep-t-dynamic
-version:             0.1.0.0
+version:             0.1.0.1
 synopsis:            A dynamic environment for dependency injection.
 description:         This library is a companion to "dep-t". It provides "environments"
                      into which you 
@@ -29,13 +29,13 @@   location: https://github.com/danidiaz/dep-t-dynamic.git
 
 common common
-  build-depends:       base >=4.10.0.0 && < 5,
-                       transformers ^>= 0.5.0.0,
-                       dep-t >= 0.6.1.0 && < 0.7,
+  build-depends:       base >= 4.10.0.0 && < 5,
+                       transformers >= 0.5.0.0,
+                       dep-t ^>= 0.6.1.0,
                        unordered-containers >= 0.2.14,
-                       hashable >=1.0.1.1 && <1.50,
+                       hashable >= 1.0.1.1,
                        sop-core ^>= 0.5.0.0,
-                       algebraic-graphs ^>= 0.5
+                       algebraic-graphs ^>= 0.6
   default-language:    Haskell2010
 
 library
@@ -54,8 +54,8 @@                        dep-t-dynamic, 
                        template-haskell,
                        text,
-                       unliftio-core ^>= 0.2.0.0,
-                       mtl ^>= 2.2,
+                       unliftio-core >= 0.2.0.0,
+                       mtl >= 2.2,
 
 common common-tasty
   import:              common-tests
@@ -84,7 +84,7 @@   build-depends:       aeson,
                        containers,
                        unordered-containers >= 0.2.14,
-                       microlens ^>= 0.4.12.0
+                       microlens >= 0.4.12.0
 
 -- VERY IMPORTANT for doctests to work: https://stackoverflow.com/a/58027909/1364288
 -- http://hackage.haskell.org/package/cabal-doctest
@@ -98,5 +98,5 @@                        dep-t, 
                        dep-t-dynamic,
                        dep-t-advice,
-                       doctest            ^>= 0.18,
+                       doctest            ^>= 0.20,
 
lib/Dep/Checked.hs view
@@ -94,13 +94,13 @@ import Type.Reflection qualified as R
 import Data.Functor
 import Algebra.Graph 
-import qualified Algebra.Graph.Bipartite.Undirected.AdjacencyMap as Bipartite
+import qualified Algebra.Graph.Bipartite.AdjacencyMap as Bipartite
 
 -- | A dependency injection environment for components with effects in the monad @(DepT me_ m)@.
--- Parameterized by 'Applicative' @phases@, the environment type constructor
+-- Parameterized by an 'Applicative' phase @h@, the environment type constructor
 -- @me_@ used by the 'DepT' transformer, and the type @m@ of the base
 -- monad.
-data CheckedEnv phases me_ m = CheckedEnv DepGraph (DynamicEnv phases (DepT me_ m))
+data CheckedEnv h me_ m = CheckedEnv DepGraph (DynamicEnv h (DepT me_ m))
 
 -- | Add a component to a 'CheckedEnv'.
 --
@@ -114,18 +114,18 @@ --
 -- It's impossible to add a component without explicitly listing all its dependencies. 
 --
--- In addition, you must also provide the @phases (r_ (DepT e_ n))@ value, an implementation of the component that comes
+-- In addition, you must also provide the @h (r_ (DepT e_ n))@ value, an implementation of the component that comes
 -- wrapped in some 'Applicative'. Notice that this value must be sufficiently polymorphic.
 --
 -- The @QuantifiedConstraint@ says that, whatever the environment the 'DepT' uses, if @DynamicEnv Identity n@ has a 'Has'
 -- constraint, the 'DepT' environment must also have that constraint. This is trivially true when they are the same type,
 -- but may also be true when the 'DepT' environment wraps the 'DynamicEnv' and defines passthrough 'Has' instances.
 checkedDep ::
-  forall r_ rs mcs phases me_ m.
+  forall r_ rs mcs h me_ m.
   ( SOP.All R.Typeable rs,
     SOP.All R.Typeable mcs,
     R.Typeable r_,
-    R.Typeable phases,
+    R.Typeable h,
     R.Typeable me_,
     R.Typeable m,
     HasAll rs (DepT me_ m) (me_ (DepT me_ m)),
@@ -139,11 +139,11 @@       Monad n, 
       MonadSatisfiesAll mcs (DepT e_ n)
     ) =>
-    phases (r_ (DepT e_ n))
+    h (r_ (DepT e_ n))
   ) ->
   -- | The environment in which to insert
-  CheckedEnv phases me_ m ->
-  CheckedEnv phases me_ m
+  CheckedEnv h me_ m ->
+  CheckedEnv h me_ m
 checkedDep f (CheckedEnv DepGraph {provided,required,depToDep,depToMonad} de) =
   let demoteDep :: forall (x :: (Type -> Type) -> Type). R.Typeable x => K SomeDepRep x
       demoteDep = K (depRep @x)
@@ -164,21 +164,21 @@ -- | '(<>)' might result in over-restrictive dependency graphs, because
 -- dependencies for colliding components are kept even as only one of the
 -- components is kept.
-instance Semigroup (CheckedEnv phases me_ m) where
+instance Semigroup (CheckedEnv h me_ m) where
   CheckedEnv g1 env1 <> CheckedEnv g2 env2 = CheckedEnv (g1 <> g2) (env1 <> env2)
 
 -- | 'mempty' is for creating the empty environment.
-instance Monoid (CheckedEnv phases me_ m) where
+instance Monoid (CheckedEnv h me_ m) where
   mempty = CheckedEnv mempty mempty
 
 -- | Extract the underlying 'DynamicEnv' along with the dependency graph, without checking that all dependencies are satisfied.
-getUnchecked :: CheckedEnv phases me_ m -> (DepGraph, DynamicEnv phases (DepT me_ m))
+getUnchecked :: CheckedEnv h me_ m -> (DepGraph, DynamicEnv h (DepT me_ m))
 getUnchecked (CheckedEnv g d) = (g, d)
 
 -- | Either fail with a the set of missing dependencies, or
 -- succeed and produce the the underlying 'DynamicEnv' along with the
 -- dependency graph.
-checkEnv :: CheckedEnv phases me_ m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv phases (DepT me_ m))
+checkEnv :: CheckedEnv h me_ m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv h (DepT me_ m))
 checkEnv (CheckedEnv g@DepGraph {required,provided} d) = 
   let missing = HashSet.difference required provided 
    in if HashSet.null missing
@@ -209,4 +209,4 @@ -- >>> import Dep.Env
 -- >>> import Dep.Dynamic
 -- >>> import Dep.Checked
--- >>> import Dep.Advice (component, runFromDep)+-- >>> import Dep.Advice (component, runFromDep)
lib/Dep/Dynamic.hs view
@@ -133,7 +133,6 @@ import Type.Reflection qualified as R
 import Data.Hashable
 import Algebra.Graph 
-import qualified Algebra.Graph.Bipartite.Undirected.AdjacencyMap as Bipartite
 import Dep.Dynamic.Internal
 import Data.Monoid
 
lib/Dep/Dynamic/Internal.hs view
@@ -49,7 +49,7 @@ import Type.Reflection qualified as R
 import Data.Hashable
 import Algebra.Graph 
-import qualified Algebra.Graph.Bipartite.Undirected.AdjacencyMap as Bipartite
+import qualified Algebra.Graph.Bipartite.AdjacencyMap as Bipartite
 
 
 -- | The type rep of a constraint over a monad. Similar to 'Type.Reflection.SomeTypeRep' 
lib/Dep/SimpleChecked.hs view
@@ -88,11 +88,11 @@ import Type.Reflection qualified as R
 import Data.Functor
 import Algebra.Graph 
-import qualified Algebra.Graph.Bipartite.Undirected.AdjacencyMap as Bipartite
+import qualified Algebra.Graph.Bipartite.AdjacencyMap as Bipartite
 
 -- | A dependency injection environment for components with effects in the monad @m@.
--- Parameterized by 'Applicative' @phases@, and the type @m@ of the effect monad.
-data CheckedEnv phases m = CheckedEnv DepGraph (DynamicEnv (phases `Compose` Constructor (DynamicEnv Identity m)) m)
+-- Parameterized by an 'Applicative' phase @h@, and the type @m@ of the effect monad.
+data CheckedEnv h m = CheckedEnv DepGraph (DynamicEnv (h `Compose` Constructor (DynamicEnv Identity m)) m)
 
 -- | Add a component to a 'CheckedEnv'.
 --
@@ -106,14 +106,14 @@ --
 -- It's impossible to add a component without explicitly listing all its dependencies. 
 --
--- In addition, you must also provide the @(phases `Compose` Constructor e)@ value, an implementation of the component that comes
+-- In addition, you must also provide the @(h `Compose` Constructor e)@ value, an implementation of the component that comes
 -- wrapped in some 'Applicative'. Notice that this value must be sufficiently polymorphic.
 checkedDep ::
-  forall r_ rs mcs phases m.
+  forall r_ rs mcs h m.
   ( SOP.All R.Typeable rs,
     SOP.All R.Typeable mcs,
     R.Typeable r_,
-    R.Typeable phases,
+    R.Typeable h,
     R.Typeable m,
     HasAll rs m (DynamicEnv Identity m),
     Monad m, 
@@ -125,11 +125,11 @@       Monad m, 
       MonadSatisfiesAll mcs n
     ) =>
-    (phases `Compose` Constructor e) (r_ n)
+    (h `Compose` Constructor e) (r_ n)
   ) ->
   -- | The environment in which to insert
-  CheckedEnv phases m ->
-  CheckedEnv phases m
+  CheckedEnv h m ->
+  CheckedEnv h m
 checkedDep f (CheckedEnv DepGraph {provided,required,depToDep,depToMonad} de) =
   let demoteDep :: forall (x :: (Type -> Type) -> Type). R.Typeable x => K SomeDepRep x
       demoteDep = K (depRep @x)
@@ -150,21 +150,21 @@ -- | '(<>)' might result in over-restrictive dependency graphs, because
 -- dependencies for colliding components are kept even as only one of the
 -- components is kept.
-instance Semigroup (CheckedEnv phases m) where
+instance Semigroup (CheckedEnv h m) where
   CheckedEnv g1 env1 <> CheckedEnv g2 env2 = CheckedEnv (g1 <> g2) (env1 <> env2)
 
 -- | 'mempty' is for creating the empty environment.
-instance Monoid (CheckedEnv phases m) where
+instance Monoid (CheckedEnv h m) where
   mempty = CheckedEnv mempty mempty
 
 -- | Extract the underlying 'DynamicEnv' along with the dependency graph, without checking that all dependencies are satisfied.
-getUnchecked :: CheckedEnv phases m -> (DepGraph, DynamicEnv (phases `Compose` Constructor (DynamicEnv Identity m)) m)
+getUnchecked :: CheckedEnv h m -> (DepGraph, DynamicEnv (h `Compose` Constructor (DynamicEnv Identity m)) m)
 getUnchecked (CheckedEnv g d) = (g, d)
 
 -- | Either fail with a the set of missing dependencies, or
 -- succeed and produce the the underlying 'DynamicEnv' along with the
 -- dependency graph.
-checkEnv :: CheckedEnv phases m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv (phases `Compose` Constructor (DynamicEnv Identity m)) m)
+checkEnv :: CheckedEnv h m -> Either (HashSet SomeDepRep) (DepGraph, DynamicEnv (h `Compose` Constructor (DynamicEnv Identity m)) m)
 checkEnv (CheckedEnv g@DepGraph {required,provided} d) = 
   let missing = HashSet.difference required provided 
    in if HashSet.null missing
@@ -196,4 +196,4 @@ -- >>> import Dep.Env
 -- >>> import Dep.Dynamic
 -- >>> import Dep.SimpleChecked
--- >>> import Dep.Advice (component, runFromDep)+-- >>> import Dep.Advice (component, runFromDep)