Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- boolToMaybe :: Bool -> a -> Maybe a
- caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b
- whenNothing :: Monoid m => Maybe a -> m -> m
- fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a
- forMaybe :: [a] -> (a -> Maybe b) -> [b]
- filterMaybe :: (a -> Bool) -> a -> Maybe a
- allJustM :: Monad m => [m (Maybe a)] -> m (Maybe [a])
- whenNothingM :: Monad m => m (Maybe a) -> m () -> m ()
- whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
- unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
- unionsMaybeWith :: (a -> a -> a) -> [Maybe a] -> Maybe a
- unzipMaybe :: Maybe (a, b) -> (Maybe a, Maybe b)
- caseMaybe :: Maybe a -> b -> (a -> b) -> b
- ifJust :: Maybe a -> (a -> b) -> b -> b
- maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b
- ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b
- whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()
- liftMaybe :: Alternative f => Maybe a -> f a
- spanMaybe :: (a -> Maybe b) -> [a] -> ([b], [a])
- data Maybe a
- catMaybes :: [Maybe a] -> [a]
- fromMaybe :: a -> Maybe a -> a
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- maybe :: b -> (a -> b) -> Maybe a -> b
- isNothing :: Maybe a -> Bool
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- fromJust :: HasCallStack => Maybe a -> a
- isJust :: Maybe a -> Bool
Documentation
boolToMaybe :: Bool -> a -> Maybe a Source #
Retain object when tag is True
.
caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b Source #
fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a Source #
Monadic version of fromMaybe
.
forMaybe :: [a] -> (a -> Maybe b) -> [b] Source #
Version of mapMaybe
with different argument ordering.
filterMaybe :: (a -> Bool) -> a -> Maybe a Source #
Filtering a singleton list.
filterMaybe p a =listToMaybe
(filter
p [a])
allJustM :: Monad m => [m (Maybe a)] -> m (Maybe [a]) Source #
Lazy version of allJust . sequence
.
(allJust = mapM
for the Maybe
monad.)
Only executes monadic effect while isJust
.
whenNothingM :: Monad m => m (Maybe a) -> m () -> m () Source #
caseMaybeM
without the Just
case.
unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a Source #
unionWith
for collections of size <= 1.
unionsMaybeWith :: (a -> a -> a) -> [Maybe a] -> Maybe a Source #
unionsWith
for collections of size <= 1.
ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b Source #
caseMaybeM
with flipped branches.
whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () Source #
caseMaybeM
without the Nothing
case.
Instances
listToMaybe :: [a] -> Maybe a #
maybeToList :: Maybe a -> [a] #
fromJust :: HasCallStack => Maybe a -> a #