Skip to content

groodt/purescript-free

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

102 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Module Documentation

Module Control.Comonad.Cofree

Cofree

data Cofree f a

mkCofree

mkCofree :: forall f a. a -> f (Cofree f a) -> Cofree f a

head

head :: forall f a. Cofree f a -> a

tail

tail :: forall f a. Cofree f a -> f (Cofree f a)

functorCofree

instance functorCofree :: (Functor f) => Functor (Cofree f)

foldableCofree

instance foldableCofree :: (Foldable f) => Foldable (Cofree f)

traversableCofree

instance traversableCofree :: (Traversable f) => Traversable (Cofree f)

extendCofree

instance extendCofree :: (Functor f) => Extend (Cofree f)

comonadCofree

instance comonadCofree :: (Functor f) => Comonad (Cofree f)

applyCofree

instance applyCofree :: (Apply f) => Apply (Cofree f)

applicativeCofree

instance applicativeCofree :: (Applicative f) => Applicative (Cofree f)

bindCofree

instance bindCofree :: (MonadPlus f) => Bind (Cofree f)

monadCofree

instance monadCofree :: (MonadPlus f) => Monad (Cofree f)

Module Control.Monad.Free

Free

data Free f a
  = Pure a
  | Free (f (Free f a))
  | Gosub (forall s. (forall r. (Unit -> Free f r) -> (r -> Free f a) -> s) -> s)

FreeC

type FreeC f = Free (Coyoneda f)

MonadFree

class MonadFree f m where
  wrap :: forall a. f (m a) -> m a

functorFree

instance functorFree :: (Functor f) => Functor (Free f)

applyFree

instance applyFree :: (Functor f) => Apply (Free f)

applicativeFree

instance applicativeFree :: (Functor f) => Applicative (Free f)

bindFree

instance bindFree :: (Functor f) => Bind (Free f)

monadFree

instance monadFree :: (Functor f) => Monad (Free f)

monadTransFree

instance monadTransFree :: MonadTrans Free

monadFreeFree

instance monadFreeFree :: (Functor f) => MonadFree f (Free f)

liftF

liftF :: forall f m a. (Functor f, Monad m, MonadFree f m) => f a -> m a

pureF

pureF :: forall f a. (Applicative f) => a -> Free f a

liftFC

liftFC :: forall f a. f a -> FreeC f a

pureFC

pureFC :: forall f a. (Applicative f) => a -> FreeC f a

mapF

mapF :: forall f g a. (Functor f, Functor g) => Natural f g -> Free f a -> Free g a

injC

injC :: forall f g a. (Inject f g) => FreeC f a -> FreeC g a

runFree

runFree :: forall f a. (Functor f) => (f (Free f a) -> Free f a) -> Free f a -> a

runFree runs a computation of type Free f a, using a function which unwraps a single layer of the functor f at a time.

runFreeM

runFreeM :: forall f m a. (Functor f, MonadRec m) => (f (Free f a) -> m (Free f a)) -> Free f a -> m a

runFreeM runs a compuation of type Free f a in any Monad which supports tail recursion. See the MonadRec type class for more details.

runFreeC

runFreeC :: forall f a. (forall a. f a -> a) -> FreeC f a -> a

runFreeC is the equivalent of runFree for type constructors transformed with Coyoneda, hence we have no requirement that f be a Functor.

runFreeCM

runFreeCM :: forall f m a. (MonadRec m) => Natural f m -> FreeC f a -> m a

runFreeCM is the equivalent of runFreeM for type constructors transformed with Coyoneda, hence we have no requirement that f be a Functor.

Module Control.Monad.Trampoline

Trampoline

type Trampoline = Free Lazy

done

done :: forall a. a -> Trampoline a

suspend

suspend :: forall a. Trampoline a -> Trampoline a

delay'

delay' :: forall a. Lazy a -> Trampoline a

delay

delay :: forall a. (Unit -> a) -> Trampoline a

runTrampoline

runTrampoline :: forall a. Trampoline a -> a

Module Data.Coyoneda

CoyonedaF

newtype CoyonedaF f a i
  = CoyonedaF { fi :: f i, k :: i -> a }

Coyoneda

newtype Coyoneda f a
  = Coyoneda (Exists (CoyonedaF f a))

Natural

type Natural f g = forall a. f a -> g a

functorCoyoneda

instance functorCoyoneda :: Functor (Coyoneda f)

applyCoyoneda

instance applyCoyoneda :: (Apply f) => Apply (Coyoneda f)

applicativeCoyoneda

instance applicativeCoyoneda :: (Applicative f) => Applicative (Coyoneda f)

bindCoyoneda

instance bindCoyoneda :: (Bind f) => Bind (Coyoneda f)

monadCoyoneda

instance monadCoyoneda :: (Monad f) => Monad (Coyoneda f)

monadTransCoyoneda

instance monadTransCoyoneda :: MonadTrans Coyoneda

extendCoyoneda

instance extendCoyoneda :: (Extend w) => Extend (Coyoneda w)

comonadCoyoneda

instance comonadCoyoneda :: (Comonad w) => Comonad (Coyoneda w)

coyoneda

coyoneda :: forall f a b. (a -> b) -> f a -> Coyoneda f b

liftCoyoneda

liftCoyoneda :: forall f a. f a -> Coyoneda f a

lowerCoyoneda

lowerCoyoneda :: forall f a. (Functor f) => Coyoneda f a -> f a

liftCoyonedaT

liftCoyonedaT :: forall f g. Natural f g -> Natural (Coyoneda f) (Coyoneda g)

liftCoyonedaTF

liftCoyonedaTF :: forall f g. (Functor g) => Natural f g -> Natural (Coyoneda f) g

Module Data.Yoneda

Yoneda

newtype Yoneda f a
  = Yoneda (forall b. (a -> b) -> f b)

functorYoneda

instance functorYoneda :: Functor (Yoneda f)

applyYoneda

instance applyYoneda :: (Apply f) => Apply (Yoneda f)

applicativeYoneda

instance applicativeYoneda :: (Applicative f) => Applicative (Yoneda f)

bindCoyoneda

instance bindCoyoneda :: (Bind f) => Bind (Yoneda f)

monadYoneda

instance monadYoneda :: (Monad f) => Monad (Yoneda f)

monadTransYoneda

instance monadTransYoneda :: MonadTrans Yoneda

extendYoneda

instance extendYoneda :: (Extend w) => Extend (Yoneda w)

comonadYoneda

instance comonadYoneda :: (Comonad w) => Comonad (Yoneda w)

runYoneda

runYoneda :: forall f a b. Yoneda f a -> (a -> b) -> f b

liftYoneda

liftYoneda :: forall f a. (Functor f) => f a -> Yoneda f a

lowerYoneda

lowerYoneda :: forall f a. Yoneda f a -> f a

About

Free, Trampoline, Yoneda, Coyoneda

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PureScript 90.2%
  • JavaScript 9.8%