free-category-0.0.4.1: efficient data types for free categories and arrows

Safe HaskellNone
LanguageHaskell2010
Extensions
  • MonoLocalBinds
  • TypeFamilies
  • GADTs
  • GADTSyntax
  • PolyKinds
  • TypeSynonymInstances
  • FlexibleInstances
  • ConstrainedClassMethods
  • MultiParamTypeClasses
  • FunctionalDependencies
  • KindSignatures
  • RankNTypes
  • ExplicitNamespaces
  • ExplicitForAll

Control.Category.FreeEffect

Synopsis

Documentation

class Category c => EffectCategory c m | c -> m where Source #

Categories which can lift monadic actions, i.e. effectful categories.

Methods

effect :: m (c a b) -> c a b Source #

Instances
(Functor m, Category c) => EffectCategory (EffCat m c :: k -> k -> Type) m Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

effect :: m (EffCat m c a b) -> EffCat m c a b Source #

Monad m => EffectCategory (Kleisli m :: Type -> Type -> Type) m Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

effect :: m (Kleisli m a b) -> Kleisli m a b Source #

EffectCategory ((->) :: Type -> Type -> Type) Identity Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

effect :: Identity (a -> b) -> a -> b Source #

data EffCat :: (* -> *) -> (k -> k -> *) -> k -> k -> * where Source #

Category transformer, which adds EffectCategory instance to the underlying base category.

Constructors

Base :: c a b -> EffCat m c a b 
Effect :: m (EffCat m c a b) -> EffCat m c a b 
Instances
Monad m => FreeAlgebra2 (EffCat m :: (k -> k -> Type) -> k -> k -> Type) Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

liftFree2 :: AlgebraType0 (EffCat m) f => f a b -> EffCat m f a b #

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

codom2 :: AlgebraType0 (EffCat m) f => Proof (AlgebraType (EffCat m) (EffCat m f)) (EffCat m f) #

forget2 :: AlgebraType (EffCat m) f => Proof (AlgebraType0 (EffCat m) f) (EffCat m f) #

(Functor m, Category c) => Category (EffCat m c :: k -> k -> Type) Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

id :: EffCat m c a a #

(.) :: EffCat m c b c0 -> EffCat m c a b -> EffCat m c a c0 #

(Functor m, Category c) => EffectCategory (EffCat m c :: k -> k -> Type) m Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

effect :: m (EffCat m c a b) -> EffCat m c a b Source #

type AlgebraType (EffCat m :: (k2 -> k2 -> Type) -> k2 -> k2 -> Type) (c :: k1 -> k1 -> Type) Source # 
Instance details

Defined in Control.Category.FreeEffect

type AlgebraType (EffCat m :: (k2 -> k2 -> Type) -> k2 -> k2 -> Type) (c :: k1 -> k1 -> Type) = EffectCategory c m
type AlgebraType0 (EffCat m :: (k2 -> k2 -> Type) -> k2 -> k2 -> Type) (c :: k1 -> k1 -> Type) Source # 
Instance details

Defined in Control.Category.FreeEffect

type AlgebraType0 (EffCat m :: (k2 -> k2 -> Type) -> k2 -> k2 -> Type) (c :: k1 -> k1 -> Type) = (Monad m, Category c)

liftEffect :: (Monad m, FreeAlgebra2 cat, AlgebraType0 cat tr, Category (cat tr)) => tr a b -> EffCat m (cat tr) a b Source #

Wrap a transition into EffCat cat for any free category cat (e.g. Cat).

foldNatEffCat :: (Monad m, FreeAlgebra2 cat, AlgebraType cat c, AlgebraType0 cat tr, Category (cat tr), EffectCategory c m) => (forall x y. tr x y -> c x y) -> EffCat m (cat tr) a b -> c a b Source #

Fold FreeLifing category based on a free category cat tr (e.g. Cat tr) using a functor tr x y -> c x y.

liftKleisli :: Applicative m => (a -> b) -> Kleisli m a b Source #

Functor from (->) category to Kleisli m. If m is Identity then it will respect effect i.e. liftKleisli (effect ar) = effect (liftKleisli <$> ar).