Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Definitions and instances that use direct recursion, which (because of laziness) can lead to non-termination.
Synopsis
- anaM :: (Monad m, Steppable t f, Traversable f) => CoalgebraM m f a -> a -> m t
- ganaM :: (Monad m, Monad n, Traversable n, Steppable t f, Traversable f) => DistributiveLaw n f -> GCoalgebraM m n f a -> a -> m t
- hylo :: Functor f => Algebra f b -> Coalgebra f a -> a -> b
- ghylo :: (Comonad w, Monad m, Functor f) => DistributiveLaw f w -> DistributiveLaw m f -> GAlgebra w f b -> GCoalgebra m f a -> a -> b
- hyloM :: (Monad m, Traversable f) => AlgebraM m f b -> CoalgebraM m f a -> a -> m b
- ghyloM :: (Comonad w, Traversable w, Monad m, Traversable f, Monad n, Traversable n) => DistributiveLaw f w -> DistributiveLaw n f -> GAlgebraM m w f b -> GCoalgebraM m n f a -> a -> m b
- stream' :: (Steppable t e, Steppable u f, Functor f) => CoalgebraM Maybe f b -> (b -> ((b -> b, t) -> u) -> e t -> u) -> b -> t -> u
- streamAna :: (Steppable t e, Steppable u f, Functor f) => CoalgebraM Maybe f b -> AlgebraM ((,) (b -> b)) e t -> b -> t -> u
- streamGApo :: (Steppable t e, Steppable u f, Corecursive u f, Functor f) => Coalgebra f b -> CoalgebraM Maybe f b -> (e t -> Maybe (b -> b, t)) -> b -> t -> u
- corecursivePrism :: (Steppable t f, Recursive t f, Corecursive t f, Traversable f) => CoalgebraPrism f a -> Prism' a t
Documentation
anaM :: (Monad m, Steppable t f, Traversable f) => CoalgebraM m f a -> a -> m t Source #
This can’t be implemented in a total fashion. There is a _similar_ approach that can be total – with `ψ :: CoalgebraM m f a`, `ana (Compose . ψ)` results in something like `Nu (Compose m f)` which is akin to an effectful stream.
ganaM :: (Monad m, Monad n, Traversable n, Steppable t f, Traversable f) => DistributiveLaw n f -> GCoalgebraM m n f a -> a -> m t Source #
ghylo :: (Comonad w, Monad m, Functor f) => DistributiveLaw f w -> DistributiveLaw m f -> GAlgebra w f b -> GCoalgebra m f a -> a -> b Source #
hyloM :: (Monad m, Traversable f) => AlgebraM m f b -> CoalgebraM m f a -> a -> m b Source #
ghyloM :: (Comonad w, Traversable w, Monad m, Traversable f, Monad n, Traversable n) => DistributiveLaw f w -> DistributiveLaw n f -> GAlgebraM m w f b -> GCoalgebraM m n f a -> a -> m b Source #
stream' :: (Steppable t e, Steppable u f, Functor f) => CoalgebraM Maybe f b -> (b -> ((b -> b, t) -> u) -> e t -> u) -> b -> t -> u Source #
streamAna :: (Steppable t e, Steppable u f, Functor f) => CoalgebraM Maybe f b -> AlgebraM ((,) (b -> b)) e t -> b -> t -> u Source #
Gibbons’ metamorphism. It lazily folds a (necessarily infinite) value, incrementally re-expanding that value into some new representation.
streamGApo :: (Steppable t e, Steppable u f, Corecursive u f, Functor f) => Coalgebra f b -> CoalgebraM Maybe f b -> (e t -> Maybe (b -> b, t)) -> b -> t -> u Source #
Another form of Gibbons’ metamorphism. This one can be applied to non- infinite inputs and takes an additional “flushing” coalgebra to be applied after all the input has been consumed.
corecursivePrism :: (Steppable t f, Recursive t f, Corecursive t f, Traversable f) => CoalgebraPrism f a -> Prism' a t Source #