Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
A list-like type for lazy streams, which might terminate with an error.
This module uses common names and so is designed to be imported qualified:
import qualified Data.FailableList as FL
- data FailableList e a
- = Next a (FailableList e a)
- | Done
- | Fail e
- map :: (a -> Either e b) -> FailableList e a -> FailableList e b
- foldr :: (a -> b -> b) -> b -> (e -> b) -> FailableList e a -> b
- unfoldr :: (b -> Either e (Maybe (a, b))) -> b -> FailableList e a
Documentation
data FailableList e a Source
A list-like type for lazy sequences which might terminate with an error.
Standard lists can be converted to failable lists using
Prelude.foldr Next Done
.
Next a (FailableList e a) | |
Done | |
Fail e |
Monad (FailableList e) | |
Functor (FailableList e) | |
MonadFix (FailableList e) | |
MonadPlus (FailableList e) | |
Applicative (FailableList e) | |
Foldable (FailableList e) | |
Traversable (FailableList e) | |
Alternative (FailableList e) | |
(Eq e, Eq a) => Eq (FailableList e a) | |
(Show e, Show a) => Show (FailableList e a) | |
Monoid (FailableList e a) |
map :: (a -> Either e b) -> FailableList e a -> FailableList e bSource
Like the standard map
function, but the mapping function may
return an error.
foldr :: (a -> b -> b) -> b -> (e -> b) -> FailableList e a -> bSource
unfoldr :: (b -> Either e (Maybe (a, b))) -> b -> FailableList e aSource
Like the standard Data.List.unfoldr
function, but the step function
may return an error.