Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module re-exports a subset of Fold
, intended for when you want
to define recursion scheme instances for your existing recursive types.
Synopsis
- class Corecursive t f | t -> f where
- class Recursive t f | t -> f where
- class Projectable t f => Steppable t f | t -> f where
- class Projectable t f | t -> f where
- recursiveEq :: (Recursive t f, Steppable u f, Functor f, Foldable f, Eq1 f) => t -> u -> Bool
- recursiveShowsPrec :: (Recursive t f, Show1 f) => Int -> t -> ShowS
Documentation
class Corecursive t f | t -> f where Source #
Coinductive (potentially-infinite) structures that guarantee _productivity_ rather than termination.
Instances
Corecursive (Nu f) f Source # | |
Functor f => Corecursive (Fix f) f Source # | |
Corecursive [a] (XNor a) Source # | |
Corecursive (NonEmpty a) (AndMaybe a) Source # | |
Corecursive (Maybe a) (Const (Maybe a) :: Type -> Type) Source # | |
Corecursive (Either a b) (Const (Either a b) :: Type -> Type) Source # | |
Functor f => Corecursive (Cofree f a) (EnvT a f) Source # | |
Functor f => Corecursive (Free f a) (FreeF f a) Source # | |
class Recursive t f | t -> f where Source #
Inductive structures that can be reasoned about in the way we usually do – with pattern matching.
class Projectable t f => Steppable t f | t -> f where Source #
Structures you can walk through step-by-step.
Instances
Steppable Natural Maybe Source # | |
Steppable Void Identity Source # | |
Functor f => Steppable (Nu f) f Source # | |
Functor f => Steppable (Mu f) f Source # | |
Steppable (Fix f) f Source # | |
Steppable [a] (XNor a) Source # | |
Steppable (NonEmpty a) (AndMaybe a) Source # | |
Steppable (Maybe a) (Const (Maybe a) :: Type -> Type) Source # | |
Steppable (Either a b) (Const (Either a b) :: Type -> Type) Source # | |
Steppable (Cofree f a) (EnvT a f) Source # | |
Steppable (Free f a) (FreeF f a) Source # | |
class Projectable t f | t -> f where Source #
This type class is lawless on its own, but there exist types that can’t
implement the corresponding embed
operation. Laws are induced by
implementing either Steppable
(which extends this) or Corecursive
(which doesn’t).
Instances
Projectable Natural Maybe Source # | |
Projectable Void Identity Source # | |
Functor f => Projectable (Nu f) f Source # | |
Functor f => Projectable (Mu f) f Source # | |
Projectable (Fix f) f Source # | |
Projectable [a] (XNor a) Source # | |
Projectable (NonEmpty a) (AndMaybe a) Source # | |
Projectable (Maybe a) (Const (Maybe a) :: Type -> Type) Source # | |
Projectable (Either a b) (Const (Either a b) :: Type -> Type) Source # | |
Projectable (Cofree f a) (EnvT a f) Source # | |
Projectable (Free f a) (FreeF f a) Source # | |