Hoogle Search
Within LTS Haskell 24.42 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
data
ProxyF (f :: k) (a :: k1)functor-combinators Data.HFunctor The functor combinator that forgets all structure in the input. Ignores the input structure and stores no information. Acts like the "zero" with respect to functor combinator composition.
ComposeT ProxyF f ~ ProxyF ComposeT f ProxyF ~ ProxyF
It can be injected into (losing all information), but it is impossible to ever retract or interpret it. This is essentially ConstF ().ProxyF :: ProxyF (f :: k) (a :: k1)functor-combinators Data.HFunctor No documentation available.
data
Post a (f :: Type -> Type) bfunctor-combinators Data.HFunctor.Route A useful helper type to use with a contravariant functor combinator that allows you to tag along covariant access to all fs inside the combinator. Maybe most usefully, it can be used with Dec. Remember that Dec f a is a collection of f xs, with each x existentially wrapped. Now, for a Dec (Post a f) a, it will be a collection of f x and x -> as: not only each individual part, but a way to "re-embed" that individual part into overal a. So, you can imagine Dec (Post a f) b as a collection of f x that consumes b and produces a. When a and b are the same, Dec (Post a f) a is like the free invariant sequencer. That is, in a sense, Dec (Post a f) a contains both contravariant and covariant sequences side-by-side, consuming as and also producing as. You can build up these values with injectPre, and then use whatever typeclasses your t normally supports to build it up, like Conclude (for Div). You can then interpret it into both its contravariant and covariant contexts:
-- interpret the covariant part runCovariant :: Plus g => (f ~> g) -> Div (Post a f) a -> g a runCovariant f = interpret (f . getPost) -- interpret the contravariant part runContravariant :: Conclude g => (f ~> g) -> Div (Post a f) a -> g a runContravariant = preDivisible
The PostT type wraps up Dec (Post a f) a into a type PostT Dec f a, with nice instances/helpers. An example of a usage of this in the real world is a possible implementation of the unjson library's sum type constructor, to implement bidrectional serializers for sum types.newtype
PostT (t :: Type -> Type -> Type -> Type) (f :: Type -> Type) afunctor-combinators Data.HFunctor.Route Turn the contravariant functor combinator t into an Invariant functor combinator; if t f a "consumes" as, then PostT t f a will both consume and produce as. You can run this normally as if it were a t f a by using interpret; however, you can also interpret into covariant contexts with postPlusT, postAltT, and postFunctorT. A useful way to use this type is to use normal methods of the underlying t to assemble a final t, then using the PreT constructor to wrap it all up.
myThing :: PostT Dec MyFunctor (Either Int Bool) myThing = PostT $ decided $ (injectPost Left (mfInt :: MyFunctor Int )) (injectPost Right (mfBool :: MyFunctor Bool))
See Post for more information.PostT :: t (Post a f) a -> PostT (t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) afunctor-combinators Data.HFunctor.Route No documentation available.
data
Pre a (f :: Type -> Type) bfunctor-combinators Data.HFunctor.Route A useful helper type to use with a covariant functor combinator that allows you to tag along contravariant access to all fs inside the combinator. Maybe most usefully, it can be used with Ap. Remember that Ap f a is a collection of f xs, with each x existentially wrapped. Now, for a Ap (Pre a f) a, it will be a collection of f x and a -> xs: not only each individual part, but a way to "select" that individual part from the overal a. So, you can imagine Ap (Pre a f) b as a collection of f x that consumes a and produces b. When a and b are the same, Ap (Pre a f) a is like the free invariant sequencer. That is, in a sense, Ap (Pre a f) a contains both contravariant and covariant sequences side-by-side, consuming as and also producing as. You can build up these values with injectPre, and then use whatever typeclasses your t normally supports to build it up, like Applicative (for Ap). You can then interpret it into both its contravariant and covariant contexts:
-- interpret the covariant part runCovariant :: Applicative g => (f ~> g) -> Ap (Pre a f) a -> g a runCovariant f = interpret (f . getPre) -- interpret the contravariant part runContravariant :: Divisible g => (f ~> g) -> Ap (Pre a f) a -> g a runContravariant = preDivisible
The PreT type wraps up Ap (Pre a f) a into a type PreT Ap f a, with nice instances/helpers. An example of a usage of this in the real world is the unjson library's record type constructor, to implement bidrectional serializers for product types.newtype
PreT (t :: Type -> Type -> Type -> Type) (f :: Type -> Type) afunctor-combinators Data.HFunctor.Route Turn the covariant functor combinator t into an Invariant functor combinator; if t f a "produces" as, then PreT t f a will both consume and produce as. You can run this normally as if it were a t f a by using interpret; however, you can also interpret into covariant contexts with preDivisibleT, preDiviseT, and preContravariantT. A useful way to use this type is to use normal methods of the underlying t to assemble a final t, then using the PreT constructor to wrap it all up.
data MyType = MyType { mtInt :: Int , mtBool :: Bool , mtString :: String } myThing :: PreT Ap MyFunctor MyType myThing = PreT $ MyType $ injectPre mtInt (mfInt :: MyFunctor Int ) * injectPre mtBool (mfBool :: MyFunctor Bool ) * injectPre mtString (mfString :: MyFunctor STring)See Pre for more information.PreT :: t (Pre a f) a -> PreT (t :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) afunctor-combinators Data.HFunctor.Route No documentation available.
module Data.Type.Functor.
Product Generalized functor products based on lifted Foldables. For example, Rec f '[a,b,c] from vinyl contains an f a, f b, and f c. PMaybe f ('Just a) contains an f a and PMaybe f 'Nothing contains nothing. Also provide data types for "indexing" into each foldable.
data
PEither (a :: k -> Type) (b :: Either j k)functor-products Data.Type.Functor.Product A PEither f ('Left e) contains Sing e, and a PMaybe f ('Right a) contains an f a. In practice this can be useful in the same situatinos that PMaybe can, but with an extra value in the case where value f is "turned off" with Left.