unison-util-recursion-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Util.Recursion

Documentation

type Algebra f a = f a -> a Source #

class Recursive t f | t -> f where Source #

Minimal complete definition

embed, (cata | project)

Methods

cata :: Algebra f a -> t -> a Source #

default cata :: Functor f => (f a -> a) -> t -> a Source #

project :: t -> f t Source #

default project :: Functor f => t -> f t Source #

embed :: f t -> t Source #

Instances

Instances details
Functor f => Recursive (Fix f) f Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

cata :: Algebra f a -> Fix f -> a Source #

project :: Fix f -> f (Fix f) Source #

embed :: f (Fix f) -> Fix f Source #

Functor f => Recursive (Cofree f a) (CofreeF f a) Source #

NB: Cofree from “free” is lazy, so this instance is technically partial.

Instance details

Defined in Unison.Util.Recursion

Methods

cata :: Algebra (CofreeF f a) a0 -> Cofree f a -> a0 Source #

project :: Cofree f a -> CofreeF f a (Cofree f a) Source #

embed :: CofreeF f a (Cofree f a) -> Cofree f a Source #

cataM :: (Recursive t f, Traversable f, Monad m) => (f a -> m a) -> t -> m a Source #

para :: (Recursive t f, Functor f) => (f (t, a) -> a) -> t -> a Source #

newtype Fix f Source #

Constructors

Fix (f (Fix f)) 

Instances

Instances details
(forall a. Show a => Show (f a)) => Show (Fix f) Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

showsPrec :: Int -> Fix f -> ShowS #

show :: Fix f -> String #

showList :: [Fix f] -> ShowS #

(forall a. Eq a => Eq (f a)) => Eq (Fix f) Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

(==) :: Fix f -> Fix f -> Bool #

(/=) :: Fix f -> Fix f -> Bool #

(Eq (Fix f), forall a. Ord a => Ord (f a)) => Ord (Fix f) Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

compare :: Fix f -> Fix f -> Ordering #

(<) :: Fix f -> Fix f -> Bool #

(<=) :: Fix f -> Fix f -> Bool #

(>) :: Fix f -> Fix f -> Bool #

(>=) :: Fix f -> Fix f -> Bool #

max :: Fix f -> Fix f -> Fix f #

min :: Fix f -> Fix f -> Fix f #

Functor f => Recursive (Fix f) f Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

cata :: Algebra f a -> Fix f -> a Source #

project :: Fix f -> f (Fix f) Source #

embed :: f (Fix f) -> Fix f Source #