Hoogle Search

Within LTS Haskell 24.36 (ghc-9.10.3)

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

  1. maximumMaybe :: (Ord a, Foldable t) => t a -> Maybe a

    rio RIO.List

    No documentation available.

  2. minimumByMaybe :: Foldable t => (a -> a -> Ordering) -> t a -> Maybe a

    rio RIO.List

    No documentation available.

  3. minimumMaybe :: (Ord a, Foldable t) => t a -> Maybe a

    rio RIO.List

    No documentation available.

  4. tailMaybe :: [a] -> Maybe [a]

    rio RIO.List

    No documentation available.

  5. mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b

    rio RIO.Map

    Map values and collect the Just results.

    let f x = if x == "a" then Just "new a" else Nothing
    mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"
    

  6. mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b

    rio RIO.Map

    Map keys/values and collect the Just results.

    let f k _ = if k < 5 then Just ("key : " ++ (show k)) else Nothing
    mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"
    

  7. traverseMaybeWithKey :: Applicative f => (k -> a -> f (Maybe b)) -> Map k a -> f (Map k b)

    rio RIO.Map

    Traverse keys/values and collect the Just results.

  8. catMaybes :: [Maybe a] -> [a]

    rio RIO.Prelude

    The catMaybes function takes a list of Maybes and returns a list of all the Just values.

    Examples

    Basic usage:
    >>> catMaybes [Just 1, Nothing, Just 3]
    [1,3]
    
    When constructing a list of Maybe values, catMaybes can be used to return all of the "success" results (if the list is the result of a map, then mapMaybe would be more appropriate):
    >>> import GHC.Internal.Text.Read ( readMaybe )
    
    >>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
    [Just 1,Nothing,Just 3]
    
    >>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
    [1,3]
    

  9. forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b]

    rio RIO.Prelude

    forMaybeA == flip mapMaybeA
    

  10. forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b]

    rio RIO.Prelude

    forMaybeM == flip mapMaybeM
    

Page 159 of many | Previous | Next