dep-t-dynamic 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+8/−48 lines, 3 filesdep ~dep-tPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: dep-t
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- dep-t-dynamic.cabal +2/−2
- lib/Dep/Dynamic.hs +2/−46
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for dep-t-dynamic +## 0.1.0.2 + +* `fromBare` and `toBare` moved to dep-t and re-exported from there. + ## 0.1.0.1 * 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.1 +version: 0.1.0.2 synopsis: A dynamic environment for dependency injection. description: This library is a companion to "dep-t". It provides "environments" into which you @@ -31,7 +31,7 @@ common common build-depends: base >= 4.10.0.0 && < 5, transformers >= 0.5.0.0, - dep-t ^>= 0.6.1.0, + dep-t ^>= 0.6.2.0, unordered-containers >= 0.2.14, hashable >= 1.0.1.1, sop-core ^>= 0.5.0.0,
lib/Dep/Dynamic.hs view
@@ -98,12 +98,11 @@ , DepNotFound (..) , SomeDepRep (..) , depRep - -- * Helpers for defining phases + -- * Re-exports + , mempty , Bare , fromBare , toBare - -- * Re-exports - , mempty ) where @@ -245,49 +244,6 @@ dynTrans k dpair = case k of SomeDepRep tr -> R.withTypeable tr (withComponent tr dpair) - --- | This type family clears newtypes like 'Compose', 'Identity' and 'Constant' from a composite type, --- leaving you with a newtypeless nested type as result. --- --- The idea is that it might be easier to construct values of the \"bare\" version of a composite type, --- and later coerce them to the newtyped version using 'fromBare'. --- --- This is mainly intended for defining the nested 'Applicative' \"phases\" of components that live in a 'Phased' --- environment. It's an alternative to functions like `Dep.Env.bindPhase' and 'Dep.Env.skipPhase'. -type Bare :: Type -> Type -type family Bare x where - Bare (Compose outer inner x) = Bare (outer (Bare (inner x))) - Bare (Identity x) = Bare x - Bare (Const x k) = Bare x - Bare (Constant x k) = Bare x - Bare other = other - --- | Convert a value from its bare version to the newtyped one, usually as a step --- towards inserting it into a 'Phased' environment. --- --- >>> :{ --- type Phases = IO `Compose` IO `Compose` IO --- wrapped :: Phases Int = fromBare $ pure $ pure $ pure 3 --- :} --- --- >>> :{ --- type Phases = Constructor Int --- wrapped :: Phases Int --- wrapped = fromBare $ succ --- :} --- --- >>> :{ --- type Phases = IO `Compose` Constructor Int --- wrapped :: Phases Int --- wrapped = fromBare $ pure $ succ --- :} --- -fromBare :: Coercible phases (Bare phases) => Bare phases -> phases -fromBare = coerce - --- | Convert from the newtyped value to the bare one. 'fromBare' tends to be more useful. -toBare :: Coercible phases (Bare phases) => phases -> Bare phases -toBare = coerce -- $setup --