Hoogle Search

Within LTS Haskell 24.8 (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]

    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]
    

  2. mapMaybeT :: (m (Maybe a) -> n (Maybe b)) -> MaybeT m a -> MaybeT n b

    errors Control.Error

    Transform the computation inside a MaybeT.

  3. mapM_ :: HashTable h => ((k, v) -> ST s b) -> h s k v -> ST s ()

    hashtables Data.HashTable.Class

    A side-effecting map over the key-value records of a hash table. O(n).

  4. mapM_ :: HashTable h => ((k, v) -> IO a) -> IOHashTable h k v -> IO ()

    hashtables Data.HashTable.IO

    See the documentation for this function in mapM_.

  5. mapM_ :: ((k, v) -> ST s b) -> HashTable s k v -> ST s ()

    hashtables Data.HashTable.ST.Basic

    See the documentation for this function in mapM_.

  6. mapM_ :: ((k, v) -> ST s a) -> HashTable s k v -> ST s ()

    hashtables Data.HashTable.ST.Cuckoo

    See the documentation for this function in mapM_.

  7. mapM_ :: ((k, v) -> ST s b) -> HashTable s k v -> ST s ()

    hashtables Data.HashTable.ST.Linear

    See the documentation for this function in Data.HashTable.Class#v:mapM_.

  8. mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t

    diagrams-lib Diagrams.Prelude

    Map each element of a structure targeted by a Lens to a monadic action, evaluate these actions from left to right, and collect the results.

    >>> mapMOf both (\x -> [x, x + 1]) (1,3)
    [(1,3),(1,4),(2,3),(2,4)]
    
    mapMmapMOf traverse
    imapMOf l ≡ forM l . Indexed
    
    mapMOf :: Monad m => Iso s t a b       -> (a -> m b) -> s -> m t
    mapMOf :: Monad m => Lens s t a b      -> (a -> m b) -> s -> m t
    mapMOf :: Monad m => Traversal s t a b -> (a -> m b) -> s -> m t
    

  9. mapMOf_ :: Monad m => Getting (Sequenced r m) s a -> (a -> m r) -> s -> m ()

    diagrams-lib Diagrams.Prelude

    Map each target of a Fold on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.

    >>> mapMOf_ both putStrLn ("hello","world")
    hello
    world
    
    mapM_mapMOf_ folded
    
    mapMOf_ :: Monad m => Getter s a     -> (a -> m r) -> s -> m ()
    mapMOf_ :: Monad m => Fold s a       -> (a -> m r) -> s -> m ()
    mapMOf_ :: Monad m => Lens' s a      -> (a -> m r) -> s -> m ()
    mapMOf_ :: Monad m => Iso' s a       -> (a -> m r) -> s -> m ()
    mapMOf_ :: Monad m => Traversal' s a -> (a -> m r) -> s -> m ()
    mapMOf_ :: Monad m => Prism' s a     -> (a -> m r) -> s -> m ()
    

  10. mapM_ :: (Factorial a, Applicative m) => (a -> m b) -> a -> m ()

    monoid-subclasses Data.Semigroup.Factorial

    A mapM_ equivalent.

Page 27 of many | Previous | Next