Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Common algebras that are useful when folding.
Synopsis
- lowerMonoid :: Monoid m => (a -> m) -> XNor a m -> m
- lowerSemigroup :: Semigroup m => (a -> m) -> AndMaybe a m -> m
- lowerMonad :: Monad m => (forall x. f x -> m x) -> FreeF f a (m a) -> m a
- equal :: (Functor f, Foldable f, Eq1 f) => Day f f Bool -> Bool
- height :: Foldable f => f Integer -> Integer
- size :: Foldable f => f Natural -> Natural
- toRight :: Identity b -> Either a b
- definedOrInput :: (a -> Maybe b) -> a -> Either a b
- fromEither :: Either a a -> a
- never :: a -> Identity a
- le :: Day Maybe Maybe Bool -> Bool
- takeAnother :: Day Maybe ((,) a) b -> XNor a b
- takeAvailable :: Day Maybe (XNor a) b -> XNor a b
- takeNext :: Day Maybe ((,) a) a -> a
- maybeTakeNext :: Day Maybe (XNor a) (Maybe a) -> Maybe a
- truncate' :: Functor f => Day Maybe f a -> FreeF f () a
- diagonal :: a -> (a, a)
- unarySequence :: (a -> b) -> a -> (a, b)
- binarySequence :: (a -> b -> c) -> (a, b) -> (a, (b, c))
- ternarySequence :: (a -> b -> c -> d) -> (a, b, c) -> (a, (b, c, d))
- lucasSequence' :: Integral i => i -> i -> (i, i) -> (i, (i, i))
Documentation
lowerMonoid :: Monoid m => (a -> m) -> XNor a m -> m Source #
Converts the free monoid (a list) into some other Monoid
.
lowerSemigroup :: Semigroup m => (a -> m) -> AndMaybe a m -> m Source #
Converts the free semigroup (a non-empty list) into some other Semigroup
.
lowerMonad :: Monad m => (forall x. f x -> m x) -> FreeF f a (m a) -> m a Source #
Converts the free monad into some other Monad
.
equal :: (Functor f, Foldable f, Eq1 f) => Day f f Bool -> Bool Source #
Provides equality over arbitrary pattern functors.
height :: Foldable f => f Integer -> Integer Source #
When folded, returns the height of the data structure.
size :: Foldable f => f Natural -> Natural Source #
When folded, returns the number of nodes in the data structure.
NB: This is not the same as the length when applied to a list. I.e.,
, because this is counting the
nodes of the structure (how many length
xs + 1 == cata
size
xsNeither
s and Both
s), not how
many elements (which would be equivalent to only counting Both
s).
toRight :: Identity b -> Either a b Source #
Converts a provably infinite structure into a Partial
one (that
will never terminate).
definedOrInput :: (a -> Maybe b) -> a -> Either a b Source #
Captures the input value if the application was undefined.
fromEither :: Either a a -> a Source #
Collapses a Partial
structure to a value (probably requiring
unsafe instances).
diagonal :: a -> (a, a) Source #
Converts a single value into a tuple with the same value on both sides. > x &&& y = (x *** y) . diagonal
sequence generators
unarySequence :: (a -> b) -> a -> (a, b) Source #
binarySequence :: (a -> b -> c) -> (a, b) -> (a, (b, c)) Source #
ternarySequence :: (a -> b -> c -> d) -> (a, b, c) -> (a, (b, c, d)) Source #
lucasSequence' :: Integral i => i -> i -> (i, i) -> (i, (i, i)) Source #