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. fromMaybe :: a -> Maybe a -> a

    foundation Foundation

    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
    

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

    foundation Foundation

    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]
    

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

    foundation Foundation

    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]
    

  4. bitSizeMaybe :: Bits a => a -> Maybe Int

    foundation Foundation.Bits

    Return the number of bits in the type of the argument. The actual value of the argument is ignored. Returns Nothing for types that do not have a fixed bitsize, like Integer.

  5. lowerMaybe :: Monoid m => Maybe' m -> m

    generic-data Generic.Data.Internal.Traversable

    No documentation available.

  6. splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])

    ghc-typelits-presburger GHC.TypeLits.Presburger.Compat

    Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor

  7. tyConAppTyCon_maybe :: Type -> Maybe TyCon

    ghc-typelits-presburger GHC.TypeLits.Presburger.Compat

    The same as fst . splitTyConApp We can short-cut the FunTy case

  8. windowInvalidateMaybeRecurse :: (HasCallStack, MonadIO m, IsWindow a) => a -> Region -> Maybe WindowChildFunc -> m ()

    gi-gdk3 GI.Gdk.Objects.Window

    Adds region to the update area for window. The update area is the region that needs to be redrawn, or “dirty region.” The call windowProcessUpdates sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of window in response to those expose events. GDK will call windowProcessAllUpdates on your behalf whenever your program returns to the main loop and becomes idle, so normally there’s no need to do that manually, you just need to invalidate regions that you know should be redrawn. The childFunc parameter controls whether the region of each child window that intersects region will also be invalidated. Only children for which childFunc returns TRUE will have the area invalidated.

  9. warnMaybe :: Warn a -> Maybe a

    markup-parse MarkupParse

    Returns results, if any, ignoring warnings.

    >>> warnMaybe $ (tokenize Html) "<foo><baz"
    Just [OpenTag StartTag "foo" []]
    

  10. prop_smapMaybe :: forall r ix e a . (Eq a, Show a, Stream r ix e, Foldable (Array r ix)) => Array r ix e -> Fun e (Maybe a) -> Property

    massiv-test Test.Massiv.Array.Delayed

    No documentation available.

Page 219 of many | Previous | Next