Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
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
.
Synopsis
Documentation
The type of strict optional values.
Instances
Functor Maybe Source # | |
Foldable Maybe Source # | |
Defined in Data.Strict.Maybe fold :: Monoid m => Maybe m -> m Source # foldMap :: Monoid m => (a -> m) -> Maybe a -> m Source # foldMap' :: Monoid m => (a -> m) -> Maybe a -> m Source # foldr :: (a -> b -> b) -> b -> Maybe a -> b Source # foldr' :: (a -> b -> b) -> b -> Maybe a -> b Source # foldl :: (b -> a -> b) -> b -> Maybe a -> b Source # foldl' :: (b -> a -> b) -> b -> Maybe a -> b Source # foldr1 :: (a -> a -> a) -> Maybe a -> a Source # foldl1 :: (a -> a -> a) -> Maybe a -> a Source # toList :: Maybe a -> [a] Source # null :: Maybe a -> Bool Source # length :: Maybe a -> Int Source # elem :: Eq a => a -> Maybe a -> Bool Source # maximum :: Ord a => Maybe a -> a Source # minimum :: Ord a => Maybe a -> a Source # |
|
Traversable Maybe Source # | |
Eq1 Maybe Source # | |
Ord1 Maybe Source # | |
Defined in Data.Strict.Maybe |
|
Read1 Maybe Source # | |
Defined in Data.Strict.Maybe liftReadsPrec :: ( Int -> ReadS a) -> ReadS [a] -> Int -> ReadS ( Maybe a) Source # liftReadList :: ( Int -> ReadS a) -> ReadS [a] -> ReadS [ Maybe a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec ( Maybe a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ Maybe a] Source # |
|
Show1 Maybe Source # | |
NFData1 Maybe Source # | |
Defined in Data.Strict.Maybe |
|
Hashable1 Maybe Source # | |
Defined in Data.Strict.Maybe |
|
Eq a => Eq ( Maybe a) Source # | |
Data a => Data ( Maybe a) Source # | |
Defined in Data.Strict.Maybe gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Maybe a -> c ( Maybe a) Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( Maybe a) Source # toConstr :: Maybe a -> Constr Source # dataTypeOf :: Maybe a -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe0 (c ( Maybe a)) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe0 (c ( Maybe a)) Source # gmapT :: ( forall b. Data b => b -> b) -> Maybe a -> Maybe a Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Maybe a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Maybe a -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> Maybe a -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> Maybe a -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Maybe a -> m ( Maybe a) Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Maybe a -> m ( Maybe a) Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Maybe a -> m ( Maybe a) Source # |
|
Ord a => Ord ( Maybe a) Source # | |
Read a => Read ( Maybe a) Source # | |
Show a => Show ( Maybe a) Source # | |
Generic ( Maybe a) Source # | |
Semigroup a => Semigroup ( Maybe a) Source # | |
Semigroup a => Monoid ( Maybe a) Source # | |
Binary a => Binary ( Maybe a) Source # | |
NFData a => NFData ( Maybe a) Source # | |
Defined in Data.Strict.Maybe |
|
Hashable a => Hashable ( Maybe a) Source # | |
Generic1 Maybe Source # | |
Strict ( Maybe a) ( Maybe a) Source # | |
type Rep ( Maybe a) Source # | |
Defined in Data.Strict.Maybe
type
Rep
(
Maybe
a) =
D1
('
MetaData
"Maybe" "Data.Strict.Maybe" "strict-0.4.0.1-AAOFHkm4mgeKztrEI4BKIe" '
False
) (
C1
('
MetaCons
"Nothing" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)
:+:
C1
('
MetaCons
"Just" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
a)))
|
|
type Rep1 Maybe Source # | |
Defined in Data.Strict.Maybe
type
Rep1
Maybe
=
D1
('
MetaData
"Maybe" "Data.Strict.Maybe" "strict-0.4.0.1-AAOFHkm4mgeKztrEI4BKIe" '
False
) (
C1
('
MetaCons
"Nothing" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)
:+:
C1
('
MetaCons
"Just" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
)
Par1
))
|
listToMaybe :: [a] -> Maybe a Source #
Analogous to
listToMaybe
in
Data.Maybe
.
maybeToList :: Maybe a -> [a] Source #
Analogous to
maybeToList
in
Data.Maybe
.