Hoogle Search

Within LTS Haskell 24.39 (ghc-9.10.3)

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

  1. elimMaybe :: forall a (p :: Maybe a ~> Type) (s :: Maybe a) . Sing s -> Apply p ('Nothing :: Maybe a) -> (forall (f0 :: a) . () => Sing f0 -> Apply p ('Just f0)) -> Apply p s

    eliminators Data.Eliminator

    No documentation available.

  2. EMaybe :: ElmDatatype -> ElmPrimitive

    elm-export Elm

    No documentation available.

  3. eitherMaybe :: Either () a -> Maybe a

    errors-ext Control.Error.Extensions

    Converts Either to Maybe. Specialization of either.

    maybeEither . eitherMaybe = id
    

  4. productMaybeWith :: (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]

    extrapolate Test.Extrapolate

    Take the product of lists of tiers by a function returning a Maybe value discarding Nothing values.

  5. productMaybeWith :: (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]

    extrapolate Test.Extrapolate.Core

    Take the product of lists of tiers by a function returning a Maybe value discarding Nothing values.

  6. eitherToMaybe :: Either e a -> Maybe a

    from-sum Control.FromSum

    Convert an Either to a Maybe. A Right value becomes Just.

    >>> eitherToMaybe $ Right 3
    Just 3
    
    A Left value becomes Nothing.
    >>> eitherToMaybe $ Left "bye"
    Nothing
    

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

  8. fromMaybeExceptT :: forall (m :: Type -> Type) x a . Monad m => x -> Maybe a -> ExceptT x m a

    from-sum Control.FromSum

    Lift a Maybe to an ExceptT with a default value for the case when the Maybe is Nothing. If the Maybe is Just, then just return the value like normal:

    >>> let justVal = Just True :: Maybe Bool
    
    >>> fromMaybeExceptT 5 justVal :: ExceptT Int Identity Bool
    ExceptT (Identity (Right True))
    
    If the Maybe is Nothing, then use the default value as the error value:
    >>> let nothingVal = Nothing :: Maybe Bool
    
    >>> fromMaybeExceptT 5 nothingVal :: ExceptT Int Identity Bool
    ExceptT (Identity (Left 5))
    

  9. fromMaybeM :: Applicative m => m a -> Maybe a -> m a

    from-sum Control.FromSum

    A monadic version of fromMaybe.

    fromMaybeM nothingAction === maybe nothingAction pure
    
    >>> fromMaybeM [] $ Just 5
    [5]
    
    >>> fromMaybeM [] Nothing
    []
    

  10. fromMaybeMExceptT :: Monad m => x -> m (Maybe a) -> ExceptT x m a

    from-sum Control.FromSum

    Similar to fromMaybeExceptT except the Maybe value is lifted in a Monad.

    >>> let identityNothing = Identity Nothing :: Identity (Maybe Bool)
    
    >>> fromMaybeMExceptT 5 identityNothing :: ExceptT Int Identity Bool
    ExceptT (Identity (Left 5))
    

Page 269 of many | Previous | Next