Hoogle Search

Within LTS Haskell 24.2 (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

    basic-prelude CorePrelude

    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 :: a -> Maybe a -> a

    classy-prelude ClassyPrelude

    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
    

  3. fromMaybe :: a -> Maybe a -> a

    ghc-lib-parser GHC.Data.Strict

    No documentation available.

  4. fromMaybe :: (Steppable (->) t (Either a), Corecursive (->) t (Either a)) => Maybe a -> t

    yaya Yaya.Applied

    Converts exceptional divergence to non-termination.

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

    foundation Foundation

    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 :: a -> Maybe a -> a

    massiv-test Test.Massiv.Utils

    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
    

  7. fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r

    relational-query Database.Relational.Arrow

    Operator from maybe type using record extended isNull.

  8. fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r

    relational-query Database.Relational.Projectable

    Operator from maybe type using record extended isNull.

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

    cabal-install-solver Distribution.Solver.Compat.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. fromMaybe :: forall c (f :: Type -> Type) a . c -> Colonnade f a c -> Colonnade f (Maybe a) c

    colonnade Colonnade

    Lift a column over a Maybe. For example, if some people have houses and some do not, the data that pairs them together could be represented as:

    >>> :{
    let owners :: [(Person,Maybe House)]
    owners =
    [ (Person "Jordan" 18, Nothing)
    , (Person "Ruth" 25, Just (House Red 125000))
    , (Person "Sonia" 12, Just (House Green 145000))
    ]
    :}
    
    The column encodings defined earlier can be reused with the help of fromMaybe:
    >>> :{
    let colOwners :: Colonnade Headed (Person,Maybe House) String
    colOwners = mconcat
    [ lmap fst colPerson
    , lmap snd (fromMaybe "" colHouse)
    ]
    :}
    
    >>> putStr (ascii colOwners owners)
    +--------+-----+-------+---------+
    | Name   | Age | Color | Price   |
    +--------+-----+-------+---------+
    | Jordan | 18  |       |         |
    | Ruth   | 25  | Red   | $125000 |
    | Sonia  | 12  | Green | $145000 |
    +--------+-----+-------+---------+
    

Page 2 of many | Previous | Next