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.

  1. 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.

  2. 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.

  3. mapMaybeSerialized :: forall s t (m :: Type -> Type -> Type) (n :: Type -> Type) a . (Monoid s, Monoid t, InputParsing (m s), InputParsing (m t), s ~ ParserInput (m s), t ~ ParserInput (m t), InputMappableParsing m, Functor n) => (s -> Maybe t) -> (t -> Maybe s) -> Format (m s) n s a -> Format (m t) n t a

    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.

  4. mapMaybeValue :: forall (m :: Type -> Type) a b (n :: Type -> Type) s . (Monad m, Parsing m, Show a, Show b, AlternativeFail n) => (a -> Maybe b) -> (b -> Maybe a) -> Format m n s a -> Format m n s b

    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.

  5. mapMaybeParserInput :: (InputMappableParsing m, InputParsing (m s), s ~ ParserInput (m s), Monoid s, Monoid s') => (s -> Maybe s') -> (s' -> Maybe s) -> m s a -> m s' a

    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.

  6. traceMaybe :: forall (m :: Type -> Type) a b . Monad m => (a -> Maybe b) -> Tracer m b -> Tracer m a

    contra-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 -< ()
    

  7. traceMaybeM :: Monad m => (a -> m (Maybe b)) -> Tracer m b -> Tracer m a

    contra-tracer Control.Tracer

    A monadic version of traceMaybe.

  8. mapMaybeWithKey :: GCompare k2 => (forall (v :: k1) . () => k2 v -> f v -> Maybe (g v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 g

    dependent-monoidal-map Data.Dependent.Map.Monoidal

    O(n). Map keys/values and collect the Just results.

  9. fromMaybe :: a -> Maybe a -> a

    distribution-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
    

  10. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a

    distribution-opensuse OpenSuse.Prelude

    Monadic generalisation of fromMaybe.

Page 271 of many | Previous | Next