Hoogle Search

Within LTS Haskell 24.38 (ghc-9.10.3)

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

  1. asMaybe :: Maybe a -> Maybe a

    classy-prelude-yesod ClassyPrelude.Yesod

    No documentation available.

  2. catMaybes :: (IsSequence (f (Maybe t)), Functor f, Element (f (Maybe t)) ~ Maybe t) => f (Maybe t) -> f t

    classy-prelude-yesod ClassyPrelude.Yesod

    Takes all of the Just values from a sequence of Maybe ts and concatenates them into an unboxed sequence of ts. Since 0.6.2

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

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

  4. fuseBothMaybe :: forall (m :: Type -> Type) a b r1 c r2 . Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2)

    classy-prelude-yesod ClassyPrelude.Yesod

    Like fuseBoth, but does not force consumption of the Producer. In the case that the Producer terminates, the result value is provided as a Just value. If it does not terminate, then a Nothing value is returned. One thing to note here is that "termination" here only occurs if the Producer actually yields a Nothing value. For example, with the Producer mapM_ yield [1..5], if five values are requested, the Producer has not yet terminated. Termination only occurs when the sixth value is awaited for and the Producer signals termination. Since 1.2.4

  5. isFieldMaybe :: FieldDef -> Bool

    classy-prelude-yesod ClassyPrelude.Yesod

    Check if the field is `Maybe a`

  6. listToMaybe :: [a] -> Maybe a

    classy-prelude-yesod ClassyPrelude.Yesod

    The listToMaybe function returns Nothing on an empty list or Just a where a is the first element of the list.

    Examples

    Basic usage:
    >>> listToMaybe []
    Nothing
    
    >>> listToMaybe [9]
    Just 9
    
    >>> listToMaybe [1,2,3]
    Just 1
    
    Composing maybeToList with listToMaybe should be the identity on singleton/empty lists:
    >>> maybeToList $ listToMaybe [5]
    [5]
    
    >>> maybeToList $ listToMaybe []
    []
    
    But not on lists with more than one element:
    >>> maybeToList $ listToMaybe [1,2,3]
    [1]
    

  7. mapMaybe :: (a -> Maybe b) -> [a] -> [b]

    classy-prelude-yesod ClassyPrelude.Yesod

    The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it is Just b, then b is included in the result list.

    Examples

    Using mapMaybe f x is a shortcut for catMaybes $ map f x in most cases:
    >>> import GHC.Internal.Text.Read ( readMaybe )
    
    >>> let readMaybeInt = readMaybe :: String -> Maybe Int
    
    >>> mapMaybe readMaybeInt ["1", "Foo", "3"]
    [1,3]
    
    >>> catMaybes $ map readMaybeInt ["1", "Foo", "3"]
    [1,3]
    
    If we map the Just constructor, the entire list should be returned:
    >>> mapMaybe Just [1,2,3]
    [1,2,3]
    

  8. mapOutputMaybe :: forall (m :: Type -> Type) o1 o2 i r . Monad m => (o1 -> Maybe o2) -> ConduitT i o1 m r -> ConduitT i o2 m r

    classy-prelude-yesod ClassyPrelude.Yesod

    Same as mapOutput, but use a function that returns Maybe values. Since 0.5.0

  9. runMaybeC :: forall (m :: Type -> Type) i o r . Monad m => ConduitT i o (MaybeT m) r -> ConduitT i o m (Maybe r)

    classy-prelude-yesod ClassyPrelude.Yesod

    Run MaybeT in the base monad Since 1.0.11

  10. queryMaybe :: forall (m :: Type -> Type) world a . Monad m => (world 'FieldOf -> Maybe a) -> QueryT world m (Maybe a)

    ecstasy Data.Ecstasy

    Attempt to get the value of a component.

Page 291 of many | Previous | Next