Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Cat :: (* -> * -> *) -> * -> * -> * where
- newtype C f a b = C {}
- toC :: Cat f a b -> C f a b
- fromC :: C f a b -> Cat f a b
- class FreeAlgebra2 (m :: (Type -> Type -> Type) -> Type -> Type -> Type) where
- liftFree2 :: AlgebraType0 m f => f a b -> m f a b
- foldNatFree2 :: (AlgebraType m d, AlgebraType0 m f) => (forall x y. f x y -> d x y) -> m f a b -> d a b
- codom2 :: AlgebraType0 m f => Proof (AlgebraType m (m f)) (m f)
- forget2 :: AlgebraType m f => Proof (AlgebraType0 m f) (m f)
- wrapFree2 :: (AlgebraType0 m f, FreeAlgebra2 m, Monad (m f a)) => f a (m f a b) -> m f a b
- foldFree2 :: (FreeAlgebra2 m, AlgebraType m f) => m f a b -> f a b
- hoistFree2 :: (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
- joinFree2 :: (FreeAlgebra2 m, AlgebraType0 m f) => m (m f) a b -> m f a b
- bindFree2 :: (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
Free category
data Cat :: (* -> * -> *) -> * -> * -> * where Source #
Free category encoded as a recursive data type, in a simlar way as
. You can use Free
class instance:FreeAlgebra2
liftFree2 @Cat :: f a b -> Cat f ab
foldNatFree2 @Cat :: Category d => (forall x y. f x y -> d x y) -> Cat f a b -> d a b
The same performance concerns that apply to
apply to this encoding of a free category.Free
Instances
FreeAlgebra2 Cat Source # | |
Defined in Control.Category.Free liftFree2 :: AlgebraType0 Cat f => f a b -> Cat f a b # foldNatFree2 :: (AlgebraType Cat d, AlgebraType0 Cat f) => (forall x y. f x y -> d x y) -> Cat f a b -> d a b # codom2 :: AlgebraType0 Cat f => Proof (AlgebraType Cat (Cat f)) (Cat f) # forget2 :: AlgebraType Cat f => Proof (AlgebraType0 Cat f) (Cat f) # | |
Arrow f => Arrow (Cat f) Source # | |
ArrowZero f => ArrowZero (Cat f) Source # | |
Defined in Control.Category.Free | |
ArrowChoice f => ArrowChoice (Cat f) Source # | |
Category (Cat f :: Type -> Type -> Type) Source # | |
Semigroup (Cat f o o) Source # | |
Monoid (Cat f o o) Source # | |
MSet (Cat f o o) (Cat f a o) Source # | |
SSet (Cat f o o) (Cat f a o) Source # | |
type AlgebraType0 Cat (f :: l) Source # | |
Defined in Control.Category.Free | |
type AlgebraType Cat (c :: k -> k -> Type) Source # | |
Defined in Control.Category.Free |
Free category (CPS style)
CPS style encoded free category; one can use
class
instance:FreeAlgebra2
liftFree2 @C :: f a b -> C f ab
foldNatFree2 @C :: Category d => (forall x y. f x y -> d x y) -> C f a b -> d a b
Instances
Category (C f :: k -> k -> Type) Source # | |
FreeAlgebra2 (C :: (Type -> Type -> Type) -> Type -> Type -> Type) Source # | |
Defined in Control.Category.Free liftFree2 :: AlgebraType0 C f => f a b -> C f a b # foldNatFree2 :: (AlgebraType C d, AlgebraType0 C f) => (forall x y. f x y -> d x y) -> C f a b -> d a b # codom2 :: AlgebraType0 C f => Proof (AlgebraType C (C f)) (C f) # forget2 :: AlgebraType C f => Proof (AlgebraType0 C f) (C f) # | |
Arrow f => Arrow (C f) Source # | |
ArrowZero f => ArrowZero (C f) Source # | |
Defined in Control.Category.Free | |
ArrowChoice f => ArrowChoice (C f) Source # | |
Semigroup (C f o o) Source # | |
Monoid (C f o o) Source # | |
MSet (C f o o) (C f a o) Source # | |
SSet (C f o o) (C f a o) Source # | |
type AlgebraType0 (C :: (k -> k -> Type) -> k -> k -> Type) (f :: l) Source # | |
Defined in Control.Category.Free | |
type AlgebraType (C :: (k2 -> k2 -> Type) -> k2 -> k2 -> Type) (c :: k1 -> k1 -> Type) Source # | |
Defined in Control.Category.Free |
toC :: Cat f a b -> C f a b Source #
Isomorphism from
to Cat
, which is a specialisation of
C
.hoistFreeH2
fromC :: C f a b -> Cat f a b Source #
Inverse of
, which also is a specialisatin of fromC
.hoistFreeH2
Free interface re-exports
class FreeAlgebra2 (m :: (Type -> Type -> Type) -> Type -> Type -> Type) where #
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 #
foldNatFree2 :: (AlgebraType m d, AlgebraType0 m f) => (forall x y. f x y -> d x y) -> m f a b -> d a b #
codom2 :: AlgebraType0 m f => Proof (AlgebraType m (m f)) (m f) #
forget2 :: AlgebraType m f => Proof (AlgebraType0 m f) (m f) #
Instances
wrapFree2 :: (AlgebraType0 m f, FreeAlgebra2 m, Monad (m f a)) => f a (m f a b) -> m f a b #
foldFree2 :: (FreeAlgebra2 m, AlgebraType m f) => m f a b -> f a b #
hoistFree2 :: (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 #
joinFree2 :: (FreeAlgebra2 m, AlgebraType0 m f) => m (m f) a b -> m f a b #
bindFree2 :: (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 #