Hoogle Search
Within LTS Haskell 24.51 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
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.
traceMaybe :: forall (m :: Type -> Type) a b . Monad m => (a -> Maybe b) -> Tracer m b -> Tracer m acontra-tracer Control.Tracer Run a tracer only for the Just variant of a Maybe. If it's Nothing, the nullTracer is used (no output). The arrow representation allows for proper laziness: if the tracer parameter does not produce any tracing effects, then the predicate won't even be evaluated. Contrast with the simple contravariant representation as a -> m (), in which the predicate _must_ be forced no matter what, because it's impossible to know a priori whether that function will not produce any tracing effects. It's written out explicitly for demonstration. Could also use arrow notation:
traceMaybe p tr = Tracer $ proc a -> do case k a of Just b -> use tr -< b Nothing -> Arrow.squelch -< ()
traceMaybeM :: Monad m => (a -> m (Maybe b)) -> Tracer m b -> Tracer m acontra-tracer Control.Tracer A monadic version of traceMaybe.
-
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
fromMaybeM :: Monad m => m a -> m (Maybe a) -> m adistribution-opensuse OpenSuse.Prelude Monadic generalisation of fromMaybe.