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
Functor Maybe # | |
Foldable Maybe # | |
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 # | |
Traversable Maybe # | |
Eq1 Maybe # | |
Ord1 Maybe # | |
Defined in Data.Strict.Maybe | |
Read1 Maybe # | |
Defined in Data.Strict.Maybe | |
Show1 Maybe # | |
NFData1 Maybe # | |
Defined in Data.Strict.Maybe | |
Hashable1 Maybe # | |
Defined in Data.Strict.Maybe | |
Eq a => Eq (Maybe a) # | |
Data a => Data (Maybe a) # | |
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) # | |
Ord a => Ord (Maybe a) # | |
Read a => Read (Maybe a) # | |
Show a => Show (Maybe a) # | |
Generic (Maybe a) # | |
Semigroup a => Semigroup (Maybe a) # | |
Semigroup a => Monoid (Maybe a) # | |
Binary a => Binary (Maybe a) # | |
NFData a => NFData (Maybe a) # | |
Defined in Data.Strict.Maybe | |
Hashable a => Hashable (Maybe a) # | |
Defined in Data.Strict.Maybe | |
Generic1 Maybe # | |
Strict (Maybe a) (Maybe a) # | |
type Rep (Maybe a) # | |
Defined in Data.Strict.Maybe | |
type Rep1 Maybe # | |
Defined in Data.Strict.Maybe |
listToMaybe :: [a] -> Maybe a #
Analogous to listToMaybe
in Data.Maybe.
maybeToList :: Maybe a -> [a] #
Analogous to maybeToList
in Data.Maybe.
catMaybes :: [Maybe a] -> [a] #
Analogous to catMaybes
in Data.Maybe.
mapMaybe :: (a -> Maybe b) -> [a] -> [b] #
Analogous to mapMaybe
in Data.Maybe.