Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Cat :: (k -> k -> *) -> k -> k -> * 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 :: (k -> k -> Type) -> k -> k -> Type) where
- liftFree2 :: AlgebraType0 m f => f a b -> m f a b
- foldNatFree2 :: (AlgebraType m d, AlgebraType0 m f) => (forall (x :: k) (y :: k). 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 :: k) (y :: k). 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 :: k) (y :: k). f x y -> m g x y) -> m g a b
Free category
data Cat :: (k -> k -> *) -> k -> k -> * 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 :: (k -> k -> Type) -> k -> k -> Type) 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 :: k0) (y :: k0). 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) # | |
Category (Cat f :: k -> k -> Type) Source # | |
Arrow f => Arrow (Cat f) Source # | |
ArrowZero f => ArrowZero (Cat f) Source # | |
Defined in Control.Category.Free | |
ArrowChoice f => ArrowChoice (Cat f) Source # | |
Semigroup (Cat f o o) Source # | |
Monoid (Cat f o o) Source # | |
type AlgebraType0 (Cat :: (k -> k -> Type) -> k -> k -> Type) (f :: l) Source # | |
Defined in Control.Category.Free | |
type AlgebraType (Cat :: (k2 -> k2 -> Type) -> k2 -> k2 -> Type) (c :: k1 -> k1 -> 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
FreeAlgebra2 (C :: (k -> k -> Type) -> k -> k -> 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 :: k0) (y :: k0). 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) # | |
Category (C f :: k -> k -> Type) Source # | |
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 # | |
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 :: (k -> k -> Type) -> k -> k -> 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 :: k) (y :: k). 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 :: k) (y :: k). 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 :: k) (y :: k). f x y -> m g x y) -> m g a b #