data MaybeErr val err = Succeeded val | Failed errSome operations to do with

maybeToBool :: Maybe a -> Bool -- Nothing => False; Just => True allMaybes :: [Maybe a] -> Maybe [a] firstJust :: [Maybe a] -> Maybe a findJust :: (a -> Maybe b) -> [a] -> Maybe b assocMaybe :: Eq a => [(a,b)] -> a -> Maybe b mkLookupFun :: (key -> key -> Bool) -- Equality predicate -> [(key,val)] -- The assoc list -> (key -> Maybe val) -- A lookup fun to use mkLookupFunDef :: (key -> key -> Bool) -- Equality predicate -> [(key,val)] -- The assoc list -> val -- Value to return on failure -> key -- The key -> val -- The corresponding value -- a monad thing thenMaybe :: Maybe a -> (a -> Maybe b) -> Maybe b returnMaybe :: a -> Maybe a failMaybe :: Maybe a mapMaybe :: (a -> Maybe b) -> [a] -> Maybe [b]NB:

-- a monad thing (surprise, surprise) thenMaB :: MaybeErr a err -> (a -> MaybeErr b err) -> MaybeErr b err returnMaB :: val -> MaybeErr val err failMaB :: err -> MaybeErr val err listMaybeErrs :: [MaybeErr val err] -> MaybeErr [val] [err] foldlMaybeErrs :: (acc -> input -> MaybeErr acc err) -> acc -> [input] -> MaybeErr acc [err]

Go to the first, previous, next, last section, table of contents.