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