Safe Haskell | Safe |
---|---|

Language | Haskell98 |

Extensions to Data.Maybe.

- from_just :: String -> Maybe a -> a
- maybe_unzip :: [Maybe (a, b)] -> ([Maybe a], [Maybe b])
- maybe_latch :: a -> [Maybe a] -> [a]
- maybe_latch1 :: [Maybe a] -> [a]
- maybe_map :: (a -> b) -> [Maybe a] -> [Maybe b]
- maybe_eq_by :: (t -> u -> Bool) -> Maybe t -> Maybe u -> Bool
- maybe_join' :: (s -> t) -> (s -> s -> t) -> Maybe s -> Maybe s -> Maybe t
- maybe_join :: (t -> t -> t) -> Maybe t -> Maybe t -> Maybe t
- maybe_predicate :: (a -> Bool) -> Maybe a -> Maybe a
- maybe_filter :: (a -> Bool) -> [Maybe a] -> [Maybe a]
- filter_maybe :: (a -> Bool) -> [a] -> [Maybe a]

# Documentation

maybe_unzip :: [Maybe (a, b)] -> ([Maybe a], [Maybe b]) Source #

Variant of unzip.

let r = ([Just 1,Nothing,Just 3],[Just 'a',Nothing,Just 'c']) in maybe_unzip [Just (1,'a'),Nothing,Just (3,'c')] == r

maybe_latch :: a -> [Maybe a] -> [a] Source #

maybe_latch1 :: [Maybe a] -> [a] Source #

Variant requiring initial value is not `Nothing`

.

maybe_latch1 [Just 1,Nothing,Nothing,Just 4] == [1,1,1,4]

maybe_join' :: (s -> t) -> (s -> s -> t) -> Maybe s -> Maybe s -> Maybe t Source #

Join two values, either of which may be missing.

maybe_join :: (t -> t -> t) -> Maybe t -> Maybe t -> Maybe t Source #

`maybe_join'`

of `id`

maybe_predicate :: (a -> Bool) -> Maybe a -> Maybe a Source #

Apply predicate inside `Maybe`

.

maybe_predicate even (Just 3) == Nothing

maybe_filter :: (a -> Bool) -> [Maybe a] -> [Maybe a] Source #

`map`

of `maybe_predicate`

.

let r = [Nothing,Nothing,Nothing,Just 4] in maybe_filter even [Just 1,Nothing,Nothing,Just 4] == r