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.
fromMaybe :: a -> Maybe a -> aincipit-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
fromMaybe :: SymVal a => SBV a -> SMaybe a -> SBV asbv 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.
fromMaybe :: Maybe a -> Optional acabal-gild CabalGild.Unstable.Type.Optional 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
fromMaybe :: a -> Maybe a -> afrom-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
fromMaybe :: Eq a => a -> Maybe a <-> ainvertible Data.Invertible.Maybe Convert between Nothing and a default value, or Just and its value (not a true bijection).
fromMaybe :: Exception e => e -> Maybe a -> BitGet arattletrap Rattletrap.Type.Attribute No documentation available.
fromMaybe :: a -> Maybe a -> astrict-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.
fromMaybe :: a -> Maybe a -> aclassy-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
-
relational-record Database.Relational.Documentation Operator from maybe type using record extended isNull.