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

Language | Haskell98 |

A strict version of the `Maybe`

type.

Import qualified, as in
```
import qualified Agda.Utils.Maybe.Strict as Strict
```

Copyright : (c) 2006-2007 Roman Leshchinskiy (c) 2013 Simon Meier License : BSD-style (see the file LICENSE)

Copyright : (c) 2014 Andreas Abel

- module Data.Strict.Maybe
- toStrict :: Maybe a -> Maybe a
- toLazy :: Maybe a -> Maybe a
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- catMaybes :: [Maybe a] -> [a]
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
- unzipMaybe :: Maybe (a, b) -> (Maybe a, Maybe b)
- filterMaybe :: (a -> Bool) -> a -> Maybe a
- forMaybe :: [a] -> (a -> Maybe b) -> [b]
- caseMaybe :: Maybe a -> b -> (a -> b) -> b
- maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b
- fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a
- caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b
- ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b
- whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
- whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()

# Documentation

module Data.Strict.Maybe

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

Analogous to `listToMaybe`

in Data.Maybe.

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

Analogous to `maybeToList`

in Data.Maybe.

# Collection operations.

unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a Source #

`unionWith`

for collections of size <= 1.

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

Filtering a singleton list.

filterMaybe p a =`listToMaybe`

(`filter`

p [a])

# Conditionals and loops.

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

Version of `mapMaybe`

with different argument ordering.

# Monads and Maybe.

caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b Source #

ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b Source #

`caseMaybeM`

with flipped branches.

whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () Source #

`caseMaybeM`

without the `Nothing`

case.

# Orphan instances

Foldable Maybe Source # | |

Traversable Maybe Source # | |

Data a => Data (Maybe a) Source # | |

Generic (Maybe a) Source # | |

Monoid a => Monoid (Maybe a) Source # | |

Arbitrary a => Arbitrary (Maybe a) Source # | |

CoArbitrary a => CoArbitrary (Maybe a) Source # | |

Binary a => Binary (Maybe a) Source # | |

NFData a => NFData (Maybe a) Source # | |

Null (Maybe a) Source # | |