Hoogle Search

Within LTS Haskell 24.6 (ghc-9.10.2)

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

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

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

    rio RIO.Prelude

    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]
    

  3. mapMaybe :: (Vector v a, Vector v b) => (a -> Maybe b) -> v a -> v b

    rio RIO.Vector

    No documentation available.

  4. mapMaybe :: (a -> Maybe b) -> Vector a -> Vector b

    rio RIO.Vector.Boxed

    No documentation available.

  5. mapMaybe :: (Storable a, Storable b) => (a -> Maybe b) -> Vector a -> Vector b

    rio RIO.Vector.Storable

    No documentation available.

  6. mapMaybe :: (Unbox a, Unbox b) => (a -> Maybe b) -> Vector a -> Vector b

    rio RIO.Vector.Unboxed

    No documentation available.

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

    errors Control.Error

    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. mapMaybe :: (a -> Maybe b) -> [a] -> [b]

    Cabal-syntax Distribution.Compat.Prelude

    No documentation available.

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

    relude Relude.Monad.Reexport

    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]
    

  10. mapMaybe :: Ord key => key -> Accessor (Map key elem) (Maybe elem)

    distributed-process Control.Distributed.Process.Internal.StrictContainerAccessors

    No documentation available.

Page 4 of many | Previous | Next