Hoogle Search
Within LTS Haskell 24.38 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
iterateMaybe :: forall o i u (m :: Type -> Type) . (o -> Maybe o) -> o -> Pipe i o u m ()conduino Data.Conduino.Combinators A version of iterate that can choose to terminate and stop by returning Nothing.
repeatMaybeM :: Monad m => m (Maybe o) -> Pipe i o u m ()conduino Data.Conduino.Combinators Repeat a monadic action, yielding the item in the Just every time. As soon as it sees Nothing, stop producing forever. Remember that each item will only be "executed" when something downstream requests output.
unfoldMaybe :: forall s o i u (m :: Type -> Type) . (s -> Maybe (o, s)) -> s -> Pipe i o u m ()conduino Data.Conduino.Combinators A version of unfold that can terminate and end by returning Nothing.
objectEntryMaybeParser :: (Char -> Parser a) -> Parser (Maybe (Text, Value))conduit-aeson Data.Conduit.Aeson Parse JSON key value pairs followed either by a delimiter or terminating character ']', which is also supplied to the delimiter parser. Nothing is returned when terminating character is reached.
valueMaybeParser :: (Char -> Parser a) -> Parser (Maybe Value)conduit-aeson Data.Conduit.Aeson Parse a JSON value followed either by a delimiter or terminating character ']', which is also supplied to the delimiter parser. Nothing is returned when terminating character is reached.
-
construct Construct Converts a format for serialized streams of type s so it works for streams of type t instead. The argument functions may return Nothing to indicate they have insuficient input to perform the conversion.
-
construct Construct Converts a format for in-memory values of type a so it works for values of type b instead. The argument functions may signal conversion failure by returning Nothing.
-
construct Construct.Classes Converts a parser accepting one input stream type to another just like mapParserInput, except the argument functions can return Nothing to indicate they need more input.
-
dependent-monoidal-map Data.Dependent.Map.Monoidal O(n). Map keys/values and collect the Just results.
fromMaybe :: a -> Maybe a -> adistribution-opensuse OpenSuse.Prelude The fromMaybe function takes a default value and a Maybe value. If the Maybe is Nothing, it returns the default value; otherwise, it returns the value contained in the Maybe.
Examples
Basic usage:>>> fromMaybe "" (Just "Hello, World!") "Hello, World!"
>>> fromMaybe "" Nothing ""
Read an integer from a string using readMaybe. If we fail to parse an integer, we want to return 0 by default:>>> import GHC.Internal.Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0