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) (Cofree' 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 (Cofree' f a) a0 -> Cofree f a -> a0 Source #

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

embed :: Cofree' 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 #

data Cofree' f a x Source #

Constructors

a :<< (f x) 

Instances

Instances details
Foldable f => Foldable (Cofree' f a) Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

fold :: Monoid m => Cofree' f a m -> m #

foldMap :: Monoid m => (a0 -> m) -> Cofree' f a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> Cofree' f a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> Cofree' f a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> Cofree' f a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> Cofree' f a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> Cofree' f a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> Cofree' f a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> Cofree' f a a0 -> a0 #

toList :: Cofree' f a a0 -> [a0] #

null :: Cofree' f a a0 -> Bool #

length :: Cofree' f a a0 -> Int #

elem :: Eq a0 => a0 -> Cofree' f a a0 -> Bool #

maximum :: Ord a0 => Cofree' f a a0 -> a0 #

minimum :: Ord a0 => Cofree' f a a0 -> a0 #

sum :: Num a0 => Cofree' f a a0 -> a0 #

product :: Num a0 => Cofree' f a a0 -> a0 #

Traversable f => Traversable (Cofree' f a) Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

traverse :: Applicative f0 => (a0 -> f0 b) -> Cofree' f a a0 -> f0 (Cofree' f a b) #

sequenceA :: Applicative f0 => Cofree' f a (f0 a0) -> f0 (Cofree' f a a0) #

mapM :: Monad m => (a0 -> m b) -> Cofree' f a a0 -> m (Cofree' f a b) #

sequence :: Monad m => Cofree' f a (m a0) -> m (Cofree' f a a0) #

Functor f => Functor (Cofree' f a) Source # 
Instance details

Defined in Unison.Util.Recursion

Methods

fmap :: (a0 -> b) -> Cofree' f a a0 -> Cofree' f a b #

(<$) :: a0 -> Cofree' f a b -> Cofree' f a a0 #

Functor f => Recursive (Cofree f a) (Cofree' 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 (Cofree' f a) a0 -> Cofree f a -> a0 Source #

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

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