Hoogle Search

Within LTS Haskell 24.64 (ghc-9.10.3)

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

  1. maybe :: b -> (a -> b) -> Maybe a -> b

    copilot-language Copilot.Language.Prelude

    The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result.

    Examples

    Basic usage:
    >>> maybe False odd (Just 3)
    True
    
    >>> maybe False odd Nothing
    False
    
    Read an integer from a string using readMaybe. If we succeed, return twice the integer; that is, apply (*2) to it. If instead we fail to parse an integer, return 0 by default:
    >>> import GHC.Internal.Text.Read ( readMaybe )
    
    >>> maybe 0 (*2) (readMaybe "5")
    10
    
    >>> maybe 0 (*2) (readMaybe "")
    0
    
    Apply show to a Maybe Int. If we have Just n, we want to show the underlying Int n. But if we have Nothing, we return the empty string instead of (for example) "Nothing":
    >>> maybe "" show (Just 5)
    "5"
    
    >>> maybe "" show Nothing
    ""
    

  2. maybe :: Num prob => prob -> Change a -> T prob a

    probability Numeric.Probability.Transition

    No documentation available.

  3. maybe :: b -> (a -> b) -> Maybe a -> b

    quaalude Essentials

    The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result.

    Examples

    Basic usage:
    >>> maybe False odd (Just 3)
    True
    
    >>> maybe False odd Nothing
    False
    
    Read an integer from a string using readMaybe. If we succeed, return twice the integer; that is, apply (*2) to it. If instead we fail to parse an integer, return 0 by default:
    >>> import GHC.Internal.Text.Read ( readMaybe )
    
    >>> maybe 0 (*2) (readMaybe "5")
    10
    
    >>> maybe 0 (*2) (readMaybe "")
    0
    
    Apply show to a Maybe Int. If we have Just n, we want to show the underlying Int n. But if we have Nothing, we return the empty string instead of (for example) "Nothing":
    >>> maybe "" show (Just 5)
    "5"
    
    >>> maybe "" show Nothing
    ""
    

  4. maybe :: b -> (a -> b) -> Maybe a -> b

    strict-base-types Data.Maybe.Strict

    Given a default value, a function and a Maybe value, yields the default value if the Maybe value is Nothing and applies the function to the value stored in the Just otherwise.

  5. maybe :: b -> (a -> b) -> Maybe a -> b

    verset Verset

    The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result.

    Examples

    Basic usage:
    >>> maybe False odd (Just 3)
    True
    
    >>> maybe False odd Nothing
    False
    
    Read an integer from a string using readMaybe. If we succeed, return twice the integer; that is, apply (*2) to it. If instead we fail to parse an integer, return 0 by default:
    >>> import GHC.Internal.Text.Read ( readMaybe )
    
    >>> maybe 0 (*2) (readMaybe "5")
    10
    
    >>> maybe 0 (*2) (readMaybe "")
    0
    
    Apply show to a Maybe Int. If we have Just n, we want to show the underlying Int n. But if we have Nothing, we return the empty string instead of (for example) "Nothing":
    >>> maybe "" show (Just 5)
    "5"
    
    >>> maybe "" show Nothing
    ""
    

  6. newtype MaybeApply (f :: Type -> Type) a

    semigroupoids Data.Functor.Apply

    Transform an Apply into an Applicative by adding a unit.

  7. MaybeApply :: Either (f a) a -> MaybeApply (f :: Type -> Type) a

    semigroupoids Data.Functor.Apply

    No documentation available.

  8. newtype MaybeApply (f :: Type -> Type) a

    semigroupoids Data.Functor.Bind

    Transform an Apply into an Applicative by adding a unit.

  9. MaybeApply :: Either (f a) a -> MaybeApply (f :: Type -> Type) a

    semigroupoids Data.Functor.Bind

    No documentation available.

  10. newtype MaybeApply (f :: Type -> Type) a

    semigroupoids Data.Functor.Bind.Class

    Transform an Apply into an Applicative by adding a unit.

Page 11 of many | Previous | Next