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) -> [a] -> [b]

    Cabal-syntax Distribution.Compat.Prelude

    No documentation available.

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

    leancheck Test.LeanCheck.Tiers

    Like mapMaybe but for tiers.

  3. mapMaybeMProp :: (IsList c, IsList d, Eq d, Show d, Show b, Item c ~ a, Item d ~ b, Arbitrary c, Arbitrary b, Show c, Show a, CoArbitrary a, Function a) => Proxy a -> Proxy b -> (forall s . () => (a -> ST s (Maybe b)) -> c -> ST s d) -> Property

    quickcheck-classes-base Test.QuickCheck.Classes.Base.IsList

    No documentation available.

  4. mapMaybeProp :: (IsList c, Item c ~ a, Item d ~ b, Eq d, IsList d, Arbitrary b, Show d, Show b, Arbitrary c, Show c, Show a, Eq c, CoArbitrary a, Function a) => Proxy a -> Proxy b -> ((a -> Maybe b) -> c -> d) -> Property

    quickcheck-classes-base Test.QuickCheck.Classes.Base.IsList

    Property for the mapMaybe function, which keeps elements for which the predicate holds true.

  5. mapMaybeWithKey :: GCompare k2 => (forall (v :: k1) . () => k2 v -> f v -> Maybe (g v)) -> DMap k2 f -> DMap k2 g

    dependent-map Data.Dependent.Map

    O(n). Map keys/values and collect the Just results.

  6. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

    relude Relude.Foldable.Reexport

    Map each element of a structure to a monadic action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see mapM. mapM_ is just like traverse_, but specialised to monadic actions.

  7. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]

    relude Relude.Monad.Maybe

    The monadic version of the mapMaybe function.

    >>> :{
    evenInHalf :: Int -> IO (Maybe Int)
    evenInHalf n
    | even n = pure $ Just $ n `div` 2
    | otherwise = pure Nothing
    :}
    
    >>> mapMaybeM evenInHalf [1..10]
    [1,2,3,4,5]
    

  8. 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]
    

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

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

    No documentation available.

  10. mapMaybe :: (v1 -> Maybe v2) -> InsOrdHashMap k v1 -> InsOrdHashMap k v2

    insert-ordered-containers Data.HashMap.Strict.InsOrd

    No documentation available.

Page 28 of many | Previous | Next