Module

Control.Selective.Free

Package
purescript-selective-functors
Repository
artemisSystem/purescript-selective-functors

#FreeS Source

newtype FreeS :: (Type -> Type) -> Type -> Typenewtype FreeS f a

A simple free Selective.

Constructors

Instances

#liftF Source

liftF :: forall @f. f ~> (FreeS f)

Lift a computation into the free Selective.

#runFree Source

runFree :: forall @g @f. Selective g => (f ~> g) -> ((FreeS f) ~> g)

Run a free computation.

#runFreeA Source

runFreeA :: forall @g @f. Applicative g => (f ~> g) -> ((FreeS f) ~> g)

Run a free computation in an applicative via SelectA

#runFreeM Source

runFreeM :: forall @g @f. Monad g => (f ~> g) -> ((FreeS f) ~> g)

Run a free computation in a monad via SelectM

#runFreeTS Source

runFreeTS :: forall @g @f. Traversable g => Applicative g => (f ~> g) -> ((FreeS f) ~> g)

Run a free computation in a traversable via SelectTS

#runFreeTM Source

runFreeTM :: forall @g @f. Traversable g => Applicative g => (f ~> g) -> ((FreeS f) ~> g)

Run a free computation in a traversable via SelectTM

#foldOver Source

foldOver :: forall @m @f @a. Monoid m => (forall x. f x -> m) -> FreeS f a -> m

Fold together every possible effect.

#effectsOver Source

effectsOver :: forall @f @a. Functor f => FreeS f a -> Array (f Unit)

Collect every possible effect into an Array.

#countOver Source

countOver :: forall @f @a. FreeS f a -> Int

Count how many possible effects there are.

#foldUnder Source

foldUnder :: forall @m @f @a. Monoid m => (forall x. f x -> m) -> FreeS f a -> m

Fold together every required effect.

#effectsUnder Source

effectsUnder :: forall @f @a. Functor f => FreeS f a -> Array (f Unit)

Collect every required effect into an Array.

#countUnder Source

countUnder :: forall @f @a. FreeS f a -> Int

Count how many required effects there are.

#getPure Source

getPure :: forall @a @f. FreeS f a -> Maybe a

Extract a pure value if there are no effects.