Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Common algebras that are useful when folding.
Synopsis
- binarySequence :: (a -> b -> c) -> (a, b) -> (a, (b, c))
- definedOrInput :: (a -> Maybe b) -> a -> Either a b
- compareDay :: (Functor f, Foldable f) => (f () -> f () -> Ordering) -> Day f f Ordering -> Ordering
- diagonal :: a -> Pair a a
- equal :: (Functor f, Foldable f, Eq1 f) => Day f f Bool -> Bool
- equalDay :: (Functor f, Foldable f) => (f () -> f () -> Bool) -> Day f f Bool -> Bool
- fromEither :: Either a a -> a
- height :: Foldable f => f Integer -> Integer
- le :: Day Maybe Maybe Bool -> Bool
- lowerMonad :: Monad m => (forall x. f x -> m x) -> FreeF f a (m a) -> m a
- lowerMonoid :: Monoid m => (a -> m) -> XNor a m -> m
- lowerSemigroup :: Semigroup m => (a -> m) -> AndMaybe a m -> m
- lucasSequence' :: Num n => n -> n -> (n, n) -> (n, (n, n))
- maybeTakeNext :: Day Maybe (XNor a) (Maybe a) -> Maybe a
- never :: a -> Identity a
- replaceNeither :: XNor a b -> XNor a b -> XNor a b
- showsPrecF :: Show1 f => Int -> f (Int -> ShowS) -> ShowS
- size :: Foldable f => f Natural -> Natural
- takeAnother :: Day Maybe ((,) a) b -> XNor a b
- takeAvailable :: Day Maybe (XNor a) b -> XNor a b
- takeNext :: Day Maybe ((,) a) a -> a
- ternarySequence :: (a -> b -> c -> d) -> (a, b, c) -> (a, (b, c, d))
- toRight :: Identity b -> Either a b
- truncate' :: Functor f => Day Maybe f a -> FreeF f () a
- unarySequence :: (a -> b) -> a -> (a, b)
- xnor :: c -> (a -> b -> c) -> XNor a b -> c
Documentation
binarySequence :: (a -> b -> c) -> (a, b) -> (a, (b, c)) Source #
definedOrInput :: (a -> Maybe b) -> a -> Either a b Source #
Captures the input value if the application was undefined.
compareDay :: (Functor f, Foldable f) => (f () -> f () -> Ordering) -> Day f f Ordering -> Ordering Source #
Provides ordering over arbitrary pattern functors.
Since: 0.6.1.0
diagonal :: a -> Pair a a Source #
Converts a single value into a tuple with the same value on both sides. > x &&& y = (x *** y) . diagonal
equal :: (Functor f, Foldable f, Eq1 f) => Day f f Bool -> Bool Source #
Provides equality over arbitrary pattern functors.
equalDay :: (Functor f, Foldable f) => (f () -> f () -> Bool) -> Day f f Bool -> Bool Source #
Provides equality over arbitrary pattern functors.
Since: 0.6.1.0
fromEither :: Either a a -> a Source #
Collapses a Partial
structure to a value (probably requiring
unsafe instances).
height :: Foldable f => f Integer -> Integer Source #
When folded, returns the height of the data structure.
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
.
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
.
lucasSequence' :: Num n => n -> n -> (n, n) -> (n, (n, n)) Source #
showsPrecF :: Show1 f => Int -> f (Int -> ShowS) -> ShowS Source #
Provides show over arbitrary pattern functors.
Since: 0.6.1.0
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).
ternarySequence :: (a -> b -> c -> d) -> (a, b, c) -> (a, (b, c, d)) Source #
toRight :: Identity b -> Either a b Source #
Converts a provably infinite structure into a Partial
one (that
will never terminate).
unarySequence :: (a -> b) -> a -> (a, b) Source #