Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

## Synopsis

- class FreeAlgebra2 (m :: (k -> k -> Type) -> k -> k -> Type) where
- liftFree2 :: AlgebraType0 m f => f a b -> m f a b
- foldNatFree2 :: forall (d :: k -> k -> Type) (f :: k -> k -> Type) a b. (AlgebraType m d, AlgebraType0 m f) => (forall x y. f x y -> d x y) -> m f a b -> d a b
- codom2 :: forall (f :: k -> k -> Type). AlgebraType0 m f => Proof (AlgebraType m (m f)) (m f)
- forget2 :: forall (f :: k -> k -> Type). AlgebraType m f => Proof (AlgebraType0 m f) (m f)

- newtype Proof (c :: Constraint) (a :: l) = Proof (Dict c)
- proof :: c => Proof (c :: Constraint) (a :: l)
- type family AlgebraType0 (f :: k) (a :: l) :: Constraint
- type family AlgebraType (f :: k) (a :: l) :: Constraint
- wrapFree2 :: forall (m :: (Type -> Type -> Type) -> Type -> Type -> Type) (f :: Type -> Type -> Type) a b. (AlgebraType0 m f, FreeAlgebra2 m, Monad (m f a)) => f a (m f a b) -> m f a b
- foldFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) a b. (FreeAlgebra2 m, AlgebraType m f) => m f a b -> f a b
- unFoldNatFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) d a b. (FreeAlgebra2 m, AlgebraType0 m f) => (forall x y. m f x y -> d x y) -> f a b -> d a b
- hoistFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) g a b. (FreeAlgebra2 m, AlgebraType0 m g, AlgebraType0 m f) => (forall x y. f x y -> g x y) -> m f a b -> m g a b
- hoistFreeH2 :: forall m n f a b. (FreeAlgebra2 m, FreeAlgebra2 n, AlgebraType0 m f, AlgebraType0 n f, AlgebraType m (n f)) => m f a b -> n f a b
- joinFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) a b. (FreeAlgebra2 m, AlgebraType0 m f) => m (m f) a b -> m f a b
- bindFree2 :: forall m f g a b. (FreeAlgebra2 m, AlgebraType0 m g, AlgebraType0 m f) => m f a b -> (forall x y. f x y -> m g x y) -> m g a b
- assocFree2 :: forall (m :: (Type -> Type -> Type) -> Type -> Type -> Type) (f :: Type -> Type -> Type) a b. (FreeAlgebra2 m, AlgebraType m f, Functor (m (m f) a)) => m f a (m f a b) -> m (m f) a (f a b)

# Documentation

class FreeAlgebra2 (m :: (k -> k -> Type) -> k -> k -> Type) where Source #

Free algebra similar to

and `FreeAlgebra1`

, but for types
of kind `FreeAlgebra`

`Type -> Type -> Type`

. Examples include free categories, free
arrows, etc (see 'free-category' package).

liftFree2 :: AlgebraType0 m f => f a b -> m f a b Source #

foldNatFree2 :: forall (d :: k -> k -> Type) (f :: k -> k -> Type) a b. (AlgebraType m d, AlgebraType0 m f) => (forall x y. f x y -> d x y) -> m f a b -> d a b Source #

codom2 :: forall (f :: k -> k -> Type). AlgebraType0 m f => Proof (AlgebraType m (m f)) (m f) Source #

forget2 :: forall (f :: k -> k -> Type). AlgebraType m f => Proof (AlgebraType0 m f) (m f) Source #

newtype Proof (c :: Constraint) (a :: l) Source #

A proof that constraint `c`

holds for type `a`

.

type family AlgebraType0 (f :: k) (a :: l) :: Constraint Source #

Type family which limits Hask to its full subcategory which satisfies
a given constraints. Some free algebras, like free groups, or free abelian
semigroups have additional constraints on on generators, like `Eq`

or `Ord`

.

## Instances

type AlgebraType0 Coyoneda (g :: l) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 DList (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 Maybe (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 [] (a :: l) Source # | |

Defined in Data.Algebra.Free type AlgebraType0 [] (a :: l) = () | |

type AlgebraType0 NonEmpty (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 Identity (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 (Free Group) (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 (Free Monoid) (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 (Free Semigroup) (a :: l) Source # | |

Defined in Data.Algebra.Free | |

type AlgebraType0 FreeGroupL (a :: Type) Source # | |

Defined in Data.Group.Free | |

type AlgebraType0 FreeGroup (a :: Type) Source # | |

Defined in Data.Group.Free | |

type AlgebraType0 FreeAbelianSemigroup (a :: Type) Source # | |

Defined in Data.Semigroup.Abelian | |

type AlgebraType0 FreeAbelianMonoid (a :: Type) Source # | |

Defined in Data.Monoid.Abelian | |

type AlgebraType0 FreeSemiLattice (a :: Type) Source # | |

Defined in Data.Semigroup.SemiLattice | |

type AlgebraType0 MaybeT (m :: Type -> Type) Source # | |

Defined in Control.Algebra.Free | |

type AlgebraType0 F (f :: Type -> Type) Source # | |

Defined in Control.Algebra.Free | |

type AlgebraType0 Free (f :: Type -> Type) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 Ap (g :: Type -> Type) Source # | |

Defined in Control.Algebra.Free | |

type AlgebraType0 Ap (g :: Type -> Type) Source # | |

Defined in Control.Algebra.Free | |

type AlgebraType0 Ap (g :: Type -> Type) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 Alt (f :: Type -> Type) Source # | |

Defined in Control.Algebra.Free | |

type AlgebraType0 ListT (f :: Type -> Type) Source # | |

Defined in Control.Algebra.Free | |

type AlgebraType0 DayF (g :: Type -> Type) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # | |

Defined in Control.Monad.Action | |

type AlgebraType0 (ExceptT e :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | Algebras of the same type as |

Defined in Control.Algebra.Free | |

type AlgebraType0 (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | Algebras of the same type as |

type AlgebraType0 (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | Algebras of the same type as |

type AlgebraType0 (ReaderT r :: (k -> Type) -> k -> Type) (m :: Type -> Type) Source # | Algebras of the same type as TODO: take advantage of poly-kinded |

Defined in Control.Algebra.Free | |

type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | |

type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # | |

type family AlgebraType (f :: k) (a :: l) :: Constraint Source #

Type family which for each free algebra `m`

returns a type level lambda from
types to constraints. It is describe the class of algebras for which this
free algebra is free.

A lawful instance for this type family must guarantee
that the constraint

is implied by the `AlgebraType0`

m f

constraint. This guarantees that there exists a forgetful functor from
the category of types of kind `AlgebraType`

m f`* -> *`

which satisfy

constrain to the category of types of kind `AlgebraType`

m`* -> *`

which satisfy the
`'AlgebraType0 m`

constraint.

## Instances

wrapFree2 :: forall (m :: (Type -> Type -> Type) -> Type -> Type -> Type) (f :: Type -> Type -> Type) a b. (AlgebraType0 m f, FreeAlgebra2 m, Monad (m f a)) => f a (m f a b) -> m f a b Source #

foldFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) a b. (FreeAlgebra2 m, AlgebraType m f) => m f a b -> f a b Source #

unFoldNatFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) d a b. (FreeAlgebra2 m, AlgebraType0 m f) => (forall x y. m f x y -> d x y) -> f a b -> d a b Source #

hoistFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) g a b. (FreeAlgebra2 m, AlgebraType0 m g, AlgebraType0 m f) => (forall x y. f x y -> g x y) -> m f a b -> m g a b Source #

hoistFreeH2 :: forall m n f a b. (FreeAlgebra2 m, FreeAlgebra2 n, AlgebraType0 m f, AlgebraType0 n f, AlgebraType m (n f)) => m f a b -> n f a b Source #

joinFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) a b. (FreeAlgebra2 m, AlgebraType0 m f) => m (m f) a b -> m f a b Source #

bindFree2 :: forall m f g a b. (FreeAlgebra2 m, AlgebraType0 m g, AlgebraType0 m f) => m f a b -> (forall x y. f x y -> m g x y) -> m g a b Source #

assocFree2 :: forall (m :: (Type -> Type -> Type) -> Type -> Type -> Type) (f :: Type -> Type -> Type) a b. (FreeAlgebra2 m, AlgebraType m f, Functor (m (m f) a)) => m f a (m f a b) -> m (m f) a (f a b) Source #