 | category-extras-0.53.6: Various modules and constructs inspired by category theory | Contents | Index |
|
| Control.Functor.Algebra | | Portability | non-portable (rank-2 polymorphism) | | Stability | experimental | | Maintainer | Edward Kmett <ekmett@gmail.com> |
|
|
|
| Description |
| Algebras, Coalgebras, Bialgebras, and Dialgebras and their (co)monadic
variants
|
|
| Synopsis |
|
| type Dialgebra f g a = f a -> g a | | | type GDialgebra f g w m a = f (w a) -> g (m a) | | | type Bialgebra f g a = (Algebra f a, Coalgebra g a) | | | type GBialgebra f g w m a = (GAlgebra f w a, GCoalgebra g m a) | | | type Algebra f a = f a -> a | | | type GAlgebra f w a = f (w a) -> a | | | type Coalgebra f a = a -> f a | | | type GCoalgebra f m a = a -> f (m a) | | | type Trialgebra f g h a = (Algebra f a, Dialgebra g h a) | | | liftAlgebra :: (Functor f, Comonad w) => Algebra f :~> GAlgebra f w | | | liftCoalgebra :: (Functor f, Monad m) => Coalgebra f :~> GCoalgebra f m | | | liftDialgebra :: (Functor g, Functor f, Comonad w, Monad m) => Dialgebra f g :~> GDialgebra f g w m | | | lowerAlgebra :: (Functor f, Comonad w) => Dist f w -> GAlgebra f w a -> Algebra f (w a) | | | lowerCoalgebra :: (Functor f, Monad m) => Dist m f -> GCoalgebra f m a -> Coalgebra f (m a) | | | fromCoalgebra :: Coalgebra f :~> Dialgebra Identity f | | | fromAlgebra :: Algebra f :~> Dialgebra f Identity | | | fromBialgebra :: Bialgebra f g :~> Dialgebra (f :*: Identity) (Identity :*: g) |
|
|
| Documentation |
|
| type Dialgebra f g a = f a -> g a |
| F,G-dialgebras generalize algebras and coalgebras
NB: these definitions are actually wrong.
|
|
| type GDialgebra f g w m a = f (w a) -> g (m a) |
|
| type Bialgebra f g a = (Algebra f a, Coalgebra g a) |
| F-G-bialgebras are representable by DiAlg (f :+: Identity) (Identity :+: g) a
and so add no expressive power, but are a lot more convenient.
|
|
| type GBialgebra f g w m a = (GAlgebra f w a, GCoalgebra g m a) |
|
| type Algebra f a = f a -> a |
| F-Algebras
|
|
| type GAlgebra f w a = f (w a) -> a |
| F-W-Comonadic Algebras for a given comonad W
|
|
| type Coalgebra f a = a -> f a |
| F-Coalgebras
|
|
| type GCoalgebra f m a = a -> f (m a) |
| F-M-Monadic Coalgebras for a given monad M
|
|
| type Trialgebra f g h a = (Algebra f a, Dialgebra g h a) |
| Martin Erwig's trialgebras for indexed data types
|
|
| liftAlgebra :: (Functor f, Comonad w) => Algebra f :~> GAlgebra f w |
| Turn an F-algebra into a F-W-algebra by throwing away the comonad
|
|
| liftCoalgebra :: (Functor f, Monad m) => Coalgebra f :~> GCoalgebra f m |
| Turn a F-coalgebra into a F-M-coalgebra by returning into a monad
|
|
| liftDialgebra :: (Functor g, Functor f, Comonad w, Monad m) => Dialgebra f g :~> GDialgebra f g w m |
|
| lowerAlgebra :: (Functor f, Comonad w) => Dist f w -> GAlgebra f w a -> Algebra f (w a) |
|
| lowerCoalgebra :: (Functor f, Monad m) => Dist m f -> GCoalgebra f m a -> Coalgebra f (m a) |
|
| fromCoalgebra :: Coalgebra f :~> Dialgebra Identity f |
|
| fromAlgebra :: Algebra f :~> Dialgebra f Identity |
|
| fromBialgebra :: Bialgebra f g :~> Dialgebra (f :*: Identity) (Identity :*: g) |
|
| Produced by Haddock version 2.1.0 |