Copyright | (c) 2006-2007 Roman Leshchinskiy (c) 2013 Simon Meier |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | Simon Meier <iridcode@gmail.com> |

Stability | experimental |

Portability | GHC |

Safe Haskell | None |

Language | Haskell98 |

The strict variant of the standard Haskell `Maybe`

type and the
corresponding variants of the functions from Data.Maybe.

Note that in contrast to the standard lazy `Maybe`

type, the strict
`Maybe`

type is not an applicative functor, and therefore also not a monad.
The problem is the *homomorphism* law, which states that

`pure`

f`<*>`

`pure`

x =`pure`

(f x) -- must hold for all f

This law does not hold for the expected applicative functor instance of
`Maybe`

, as this instance does not satisfy ```
pure f <*> pure _|_ = pure (f
_|_)
```

for `f = const`

.

- data Maybe a :: * -> *
- maybe :: b -> (a -> b) -> Maybe a -> b
- isJust :: Maybe a -> Bool
- isNothing :: Maybe a -> Bool
- fromJust :: Maybe a -> a
- fromMaybe :: a -> Maybe a -> a
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- catMaybes :: [Maybe a] -> [a]
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- _Just :: Prism (Maybe a) (Maybe b) a b
- _Nothing :: Prism' (Maybe a) ()

# Documentation

The type of strict optional values.

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

Analogous to `listToMaybe`

in Data.Maybe.

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

Analogous to `maybeToList`

in Data.Maybe.

# Orphan instances

Foldable Maybe Source # | |

Traversable Maybe Source # | |

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

Generic (Maybe a) Source # | |

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

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

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

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

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

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

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

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

Strict (Maybe a) (Maybe a) Source # | |