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.

  1. swervedNMap :: forall f (as :: [Type]) b . Inplus f => (NS I as -> b) -> (b -> NS I as) -> NP f as -> f b

    functor-combinators Data.Functor.Invariant.Internative

    Given a function to "discern out" a data type into possible NS (multi-way Either) branches and one to re-assemble each brann, swerve all of the components together. For example, if you had a data type

    data MyType = MTI Int | MTB Bool | MTS String
    
    and an invariant functor and Inplus 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:
    swervedNMap
    (case MTI x -> Z (I x); MTB y -> S (Z (I y)); MTS z -> S (S (Z (I z))))
    (case Z (I x) -> MTI x; S (Z (I y)) -> MTB y; S (S (Z (I z))) -> MTS z) $
    $ intPrim
    :* boolPrim
    :* stringPrim
    :* Nil
    
    Some notes on usefulness depending on how many components you have:
    • If you have 0 components, use reject directly.
    • If you have 1 component, you don't need anything.
    • If you have 2 components, use swerve directly.
    • If you have 3 or more components, these combinators may be useful; otherwise you'd need to manually peel off eithers one-by-one.
    See notes on swervedNMap for more details and caveats.

  2. hbimap :: forall (f :: k -> Type) (j :: k -> Type) (g :: k -> Type) (l :: k -> Type) . HBifunctor t => (f ~> j) -> (g ~> l) -> t f g ~> t j l

    functor-combinators Data.HBifunctor

    Swap out both transformed functors at the same time.

  3. hmap :: forall (f :: k -> Type) (g :: k -> Type) . HFunctor t => (f ~> g) -> t f ~> t g

    functor-combinators Data.HFunctor

    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.

  4. injectContramap :: (Inject t, Contravariant f) => (a -> b) -> f b -> t f a

    functor-combinators Data.HFunctor

    A useful wrapper over the common pattern of contramap-before-inject/inject-and-contramap.

  5. injectMap :: (Inject t, Functor f) => (a -> b) -> f a -> t f b

    functor-combinators Data.HFunctor

    A useful wrapper over the common pattern of fmap-before-inject/inject-and-fmap.

  6. foldMapSing :: forall (f :: Type -> Type) k (as :: f k) m . (FProd f, Monoid m) => (forall (a :: k) . () => Sing a -> m) -> Sing as -> m

    functor-products Data.Type.Functor.Product

    A foldMap over all items in a collection.

  7. ifoldMapSing :: forall (f :: Type -> Type) k (as :: f k) m . (FProd f, Monoid m) => (forall (a :: k) . () => Elem f as a -> Sing a -> m) -> Sing as -> m

    functor-products Data.Type.Functor.Product

    foldMapSing but with access to the index.

  8. module Data.GenValidity.HashMap

    No documentation available.

  9. bitmap :: GenClosure b -> ![Word]

    ghc-heap GHC.Exts.Heap

    An StgLargeBitmap describing the pointerhood of its args/free vars

  10. bitmap :: GenClosure b -> ![Word]

    ghc-heap GHC.Exts.Heap.Closures

    An StgLargeBitmap describing the pointerhood of its args/free vars

Page 1035 of many | Previous | Next