| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell98 |
Data.Fold.Class
Documentation
class Choice p => Scan p where Source
Minimal complete definition
class Scan p => Folding p where Source
Methods
prefix :: Foldable t => t a -> p a b -> p a b Source
Partially apply a Folding to some initial input on the left.
prefixOf :: Fold s a -> s -> p a b -> p a b Source
postfix :: Foldable t => p a b -> t a -> p a b Source
postfixOf :: Fold s a -> p a b -> s -> p a b Source
run :: Foldable t => t a -> p a b -> b Source
Apply a Folding to a container full of input:
>>>run ["hello","world"] $ L id (++) []"helloworld"
>>>run [1,2,3] $ L id (+) 06
beneath :: Profunctor p => Optic p Identity s t a b -> p a b -> p s t Source
This acts like a generalized notion of "costrength",
when applied to a Folding, causing it to return the
left-most value that fails to match the Prism, or the
result of accumulating rewrapped in the Prism if
everything matches.
>>>run [Left 1, Left 2, Left 3] $ beneath _Left $ R id (+) 0Left 6
>>>run [Left 1, Right 2, Right 3] $ beneath _Left $ R id (+) 0Right 2
beneath :: Prism s t a b -> p a b -> p s t beneath :: Iso s t a b -> p a b -> p s t