Hoogle Search

Within LTS Haskell 24.4 (ghc-9.10.2)

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

  1. mapMaybe :: (a -> Maybe b) -> NonEmptyVector a -> Vector b

    nonempty-vector Data.Vector.NonEmpty

    O(n) Drop elements when predicate returns Nothing If no elements satisfy the predicate, the resulting vector may be empty.

    >>> mapMaybe (\a -> if a == 2 then Nothing else Just a) (unsafeFromList [1..3])
    [1,3]
    

  2. mapMaybe :: List l => (a -> Maybe b) -> l a -> l b

    List Data.List.Class

    No documentation available.

  3. mapMaybe :: (a -> Maybe b) -> Trie a -> Maybe (Trie b)

    bcp47 Data.BCP47.Trie

    No documentation available.

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

    bcp47 Data.BCP47.Trie.Internal

    No documentation available.

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

    cabal-install-solver Distribution.Solver.Compat.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]
    

  6. mapMaybe :: Filtrable f => (a -> Maybe b) -> f a -> f b

    filtrable Data.Filtrable

    Map the container with the given function, dropping the elements for which it returns Nothing.

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

    incipit-base Incipit.Base

    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 :: (Key -> Maybe Key) -> IntMultiSet -> IntMultiSet

    multiset Data.IntMultiSet

    O(n). Map and collect the Just results.

  9. mapMaybe :: Ord b => (a -> Maybe b) -> MultiSet a -> MultiSet b

    multiset Data.MultiSet

    O(n). Map and collect the Just results.

  10. mapMaybe :: (a -> Maybe b) -> Event a -> Event b

    reactive-midyim Reactive.Banana.MIDI.Utility

    No documentation available.

Page 9 of many | Previous | Next