Hoogle Search
Within LTS Haskell 24.45 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
hmap :: forall (f :: k -> Type) (g :: k -> Type) . HFunctor t => (f ~> g) -> t f ~> t gfunctor-combinators Data.Functor.Combinator If we can turn an f into a g, then we can turn a t f into a t g. It must be the case that
hmap id == id
Essentially, t f adds some "extra structure" to f. hmap must swap out the functor, without affecting the added structure. For example, ListF f a is essentially a list of f as. If we hmap to swap out the f as for g as, then we must ensure that the "added structure" (here, the number of items in the list, and the ordering of those items) remains the same. So, hmap must preserve the number of items in the list, and must maintain the ordering. The law hmap id == id is a way of formalizing this property.injectContramap :: (Inject t, Contravariant f) => (a -> b) -> f b -> t f afunctor-combinators Data.Functor.Combinator A useful wrapper over the common pattern of contramap-before-inject/inject-and-contramap.
injectMap :: (Inject t, Functor f) => (a -> b) -> f a -> t f bfunctor-combinators Data.Functor.Combinator A useful wrapper over the common pattern of fmap-before-inject/inject-and-fmap.
runMapF :: MapF k1 (f :: k -> Type) (a :: k) -> Map k1 (f a)functor-combinators Data.Functor.Combinator No documentation available.
runNEMapF :: NEMapF k1 (f :: k -> Type) (a :: k) -> NEMap k1 (f a)functor-combinators Data.Functor.Combinator No documentation available.
-
functor-combinators Data.Functor.Invariant.Inplicative A version of gatheredNMap for non-empty NP, but only requiring an Inply instance.
-
functor-combinators Data.Functor.Invariant.Inplicative A version of gatheredNMap using XRec from vinyl instead of NP from sop-core. This can be more convenient because it doesn't require manual unwrapping/wrapping of tuple components.
-
functor-combinators Data.Functor.Invariant.Inplicative Given a function to "break out" a data type into a NP (tuple) and one to put it back together from the tuple, gather all of the components together. For example, if you had a data type
data MyType = MT Int Bool String
and an invariant functor and Inplicative instance Prim (representing, say, a bidirectional parser, where Prim Int is a bidirectional parser for an Int), then you could assemble a bidirectional parser for a MyType@ using:concaMapInplicative ((MyType x y z) -> I x :* I y :* I z :* Nil) ((I x :* I y :* I z :* Nil) -> MyType x y z) $ intPrim :* boolPrim :* stringPrim :* Nil
See notes on gatheredNMap for more details and caveats. -
functor-combinators Data.Functor.Invariant.Inplicative A version of gatheredNMap using XRec from vinyl instead of NP from sop-core. This can be more convenient because it doesn't require manual unwrapping/wrapping of tuple components.
-
functor-combinators Data.Functor.Invariant.Internative A version of swervedNMap for non-empty NS, but only requiring an Inalt instance.