-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A list-like type for lazy streams, which might terminate with an error. -- -- A list-like type for lazy streams, which might terminate with an -- error. @package failable-list @version 0.2 -- | 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
--   
module Data.FailableList -- | 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. data FailableList e a Next :: a -> (FailableList e a) -> FailableList e a Done :: FailableList e a Fail :: e -> FailableList e a -- | Like the standard null function. null :: FailableList e a -> Bool -- | Like the standard ++ function. append :: FailableList e a -> FailableList e a -> FailableList e a -- | Like the standard map function. map :: (a -> b) -> FailableList e a -> FailableList e b -- | Like the standard map function, but the mapping function may -- return an error. mapEither :: (a -> Either e b) -> FailableList e a -> FailableList e b -- | Like the standard concatMap function. concatMap :: (a -> FailableList e b) -> FailableList e a -> FailableList e b -- | Like the standard foldr function, but accepting an extra -- parameter to handle Fail items. foldr :: (a -> b -> b) -> b -> (e -> b) -> FailableList e a -> b -- | Like the standard foldl function, but errors will return a -- Left value. foldl :: (b -> a -> b) -> b -> FailableList e a -> Either e b -- | Like the standard Data.List.unfoldr function, but the step -- function may return an error. unfoldr :: (b -> Either e (Maybe (a, b))) -> b -> FailableList e a -- | Like the standard length function; Done and Fail -- are considered 0-length. length :: FailableList e a -> Int instance (Eq e, Eq a) => Eq (FailableList e a) instance (Show e, Show a) => Show (FailableList e a) instance MonadFix (FailableList e) instance Traversable (FailableList e) instance Foldable (FailableList e) instance Applicative (FailableList e) instance Alternative (FailableList e) instance MonadPlus (FailableList e) instance Monad (FailableList e) instance Monoid (FailableList e a) instance Functor (FailableList e)