Hoogle Search

Within LTS Haskell 24.3 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. fromMaybe :: a -> Maybe a -> a

    incipit-base Incipit.Base

    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
    

  2. fromMaybe :: SymVal a => SBV a -> SMaybe a -> SBV a

    sbv Data.SBV.Maybe

    Return the value of an optional value. The default is returned if Nothing. Compare to fromJust.

    >>> fromMaybe 2 (sNothing :: SMaybe Integer)
    2 :: SInteger
    
    >>> fromMaybe 2 (sJust 5 :: SMaybe Integer)
    5 :: SInteger
    
    >>> prove $ \x -> fromMaybe x (sNothing :: SMaybe Integer) .== x
    Q.E.D.
    
    >>> prove $ \x -> fromMaybe (x+1) (sJust x :: SMaybe Integer) .== x
    Q.E.D.
    

  3. fromMaybe :: Maybe a -> Optional a

    cabal-gild CabalGild.Unstable.Type.Optional

    Converts a Maybe value into an Optional one.

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

  5. fromMaybe :: a -> Maybe a -> a

    from-sum Control.FromSum

    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
    

  6. fromMaybe :: Eq a => a -> Maybe a <-> a

    invertible Data.Invertible.Maybe

    Convert between Nothing and a default value, or Just and its value (not a true bijection).

  7. fromMaybe :: Exception e => e -> Maybe a -> BitGet a

    rattletrap Rattletrap.Type.Attribute

    No documentation available.

  8. fromMaybe :: a -> Maybe a -> a

    strict-base-types Data.Maybe.Strict

    Given a default value and a Maybe, yield the default value if the Maybe argument is Nothing and extract the value out of the Just otherwise.

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

    classy-prelude-yesod ClassyPrelude.Yesod

    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. fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r

    relational-record Database.Relational.Documentation

    Operator from maybe type using record extended isNull.

Page 3 of many | Previous | Next