Hoogle Search
Within LTS Haskell 22.18 (ghc-9.6.4)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
fromMaybe :: a -> Maybe a -> abase Data.Maybe 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 Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0
fromMaybe :: a -> Maybe a -> aamazonka-core Amazonka.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 Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0
fromMaybe :: a -> Maybe a -> aghc GHC.Data.Strict No documentation available.
fromMaybe :: a -> Maybe a -> ario RIO.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 Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0
fromMaybe :: e -> Maybe a -> Exceptional e aexplicit-exception Control.Monad.Exception.Synchronous No documentation available.
fromMaybe :: a -> Maybe a -> astrict Data.Strict.Maybe 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.
fromMaybe :: a -> Maybe a -> aerrors Control.Error 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 Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0
fromMaybe :: a -> Maybe a -> arelude Relude.Monad.Reexport 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 Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0
fromMaybe :: a -> Maybe a -> aCabal-syntax Distribution.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 Text.Read ( readMaybe ) >>> fromMaybe 0 (readMaybe "5") 5 >>> fromMaybe 0 (readMaybe "") 0
fromMaybe :: a -> Maybe a -> aghc-lib-parser GHC.Data.Strict No documentation available.
Page 1 of many | Next