free-category-0.0.4.3: 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

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

Defined in Control.Category.FreeEffect

Methods

effect :: forall (a :: k0) (b :: k0). 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 :: forall (a :: k) (b :: k). 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 :: forall (a :: k) (b :: k). Identity (a -> b) -> a -> b Source #

data EffCat :: (Type -> Type) -> (k -> k -> Type) -> k -> k -> Type 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

Instances details
Monad m => FreeAlgebra2 (EffCat m :: (k -> k -> Type) -> k -> k -> Type) Source # 
Instance details

Defined in Control.Category.FreeEffect

Methods

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

foldNatFree2 :: forall d f (a :: k0) (b :: k0). (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 :: forall (f :: k0 -> k0 -> Type). AlgebraType0 (EffCat m) f => Proof (AlgebraType (EffCat m) (EffCat m f)) (EffCat m f) #

forget2 :: forall (f :: k0 -> k0 -> Type). 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 :: forall (a :: k0). EffCat m c a a #

(.) :: forall (b :: k0) (c0 :: k0) (a :: k0). 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 :: forall (a :: k0) (b :: k0). 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 FreeLifting category based on a free category cat tr (e.g. C tr) using a functor tr x y -> c x y.

runEffCat :: Monad m => EffCat m c a b -> m (c a b) Source #

Join all effects in a free effectful category EffCat.

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).