invertible-0.2.0.8: bidirectional arrows, bijective functions, and invariant functors
Safe HaskellSafe
LanguageHaskell2010

Data.Invertible.Maybe

Description

Bidirectional version of Data.Maybe.

Synopsis

Documentation

isJust :: Maybe () <-> Bool Source #

Convert between 'Just ()' and True (see isJust).

isNothing :: Maybe () <-> Bool Source #

Convert between Nothing and True (see isNothing). (not . isJust)

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

Convert between (the head of) a (singleton) list and Maybe (see listToMaybe). (invert maybeToList)

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

Convert between Maybe and a (singleton) list (see maybeToList). (invert listToMaybe)

fromMaybe :: Eq a => a -> Maybe a <-> a Source #

Convert between Nothing and a default value, or Just and its value (not a true bijection).

fromJust :: Maybe a <-> a Source #

Convert between Just and its value.