yaya-0.3.1.1: Total recursion schemes.

Safe HaskellSafe
LanguageHaskell2010

Yaya.Functor

Description

This should probably be a separate library, but it provides a number of functor type classes between various categories.

Synopsis
  • class DFunctor (d :: (* -> *) -> *) where
    • dmap :: (forall x. f x -> g x) -> d f -> d g
  • firstMap :: (DFunctor d, Bifunctor f) => (a -> b) -> d (f a) -> d (f b)
  • class HFunctor (h :: (* -> *) -> * -> *) where
    • hmap :: (forall x. f x -> g x) -> h f a -> h g a

Documentation

class DFunctor (d :: (* -> *) -> *) where Source #

A functor from the category of endofunctors to *Hask*. The D is meant to be a mnemonic for “down”, as we’re “lowering” from endofunctors to types.

Methods

dmap :: (forall x. f x -> g x) -> d f -> d g Source #

Instances
DFunctor Nu Source # 
Instance details

Defined in Yaya.Fold

Methods

dmap :: (forall x. f x -> g x) -> Nu f -> Nu g Source #

DFunctor Mu Source # 
Instance details

Defined in Yaya.Fold

Methods

dmap :: (forall x. f x -> g x) -> Mu f -> Mu g Source #

firstMap :: (DFunctor d, Bifunctor f) => (a -> b) -> d (f a) -> d (f b) Source #

This isn’t a Functor instance because of the position of the a, but you can use it like: > newtype List a = List (Mu (XNor a)) > instance Functor List where > fmap f (List mu) = List (firstMap f mu)

class HFunctor (h :: (* -> *) -> * -> *) where Source #

An endofunctor in the category of endofunctors.

Methods

hmap :: (forall x. f x -> g x) -> h f a -> h g a Source #