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

    Cabal-syntax Distribution.Compat.Prelude

    No documentation available.

  2. mappend :: Monoid a => a -> a -> a

    Cabal-syntax Distribution.Compat.Prelude

    No documentation available.

  3. mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b

    hasql Hasql.TestingKit.Preludes.Base

    Map the unwrapped computation using the given function.

  4. mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b

    hasql Hasql.TestingKit.Preludes.Base

    Map the unwrapped computation using the given function.

  5. mapM :: Monad m => (a -> m b) -> Stream (Of a) m r -> Stream (Of b) m r

    streaming Streaming.Prelude

    Replace each element of a stream with the result of a monadic action

    >>> S.print $ S.mapM readIORef $ S.chain (\ior -> modifyIORef ior (*100)) $ S.mapM newIORef $ each [1..6]
    100
    200
    300
    400
    500
    600
    
    See also chain for a variant of this which ignores the return value of the function and just uses the side effects.

  6. mapM_ :: Monad m => (a -> m x) -> Stream (Of a) m r -> m r

    streaming Streaming.Prelude

    Reduce a stream to its return value with a monadic action.

    >>> S.mapM_ Prelude.print $ each [1..3]
    1
    2
    3
    
    >>> rest <- S.mapM_ Prelude.print $ S.splitAt 3 $ each [1..10]
    1
    2
    3
    
    >>> S.sum rest
    49 :> ()
    

  7. mapMaybe :: forall (m :: Type -> Type) a b r . Monad m => (a -> Maybe b) -> Stream (Of a) m r -> Stream (Of b) m r

    streaming Streaming.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 Stream. If it is Just b, then b is included in the result Stream.

  8. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> Stream (Of a) m r -> Stream (Of b) m r

    streaming Streaming.Prelude

    Map monadically over a stream, producing a new stream only containing the Just values.

  9. mapOf :: (a -> b) -> Of a r -> Of b r

    streaming Streaming.Prelude

    Map a function over the first element of an Of pair

    >>> S.mapOf even (1:>"hi")
    False :> "hi"
    
    mapOf is just first from the Bifunctor instance
    >>> first even (1:>"hi")
    False :> "hi"
    
    and is contained in the _first lens
    >>> import Lens.Micro
    
    >>> over S._first even (1:>"hi")
    False :> "hi"
    

  10. mapped :: (Monad m, Functor f) => (forall x . () => f x -> m (g x)) -> Stream f m r -> Stream g m r

    streaming Streaming.Prelude

    Map layers of one functor to another with a transformation involving the base monad. This function is completely functor-general. It is often useful with the more concrete type

    mapped :: (forall x. Stream (Of a) IO x -> IO (Of b x)) -> Stream (Stream (Of a) IO) IO r -> Stream (Of b) IO r
    
    to process groups which have been demarcated in an effectful, IO-based stream by grouping functions like group, split or breaks. Summary functions like fold, foldM, mconcat or toList are often used to define the transformation argument. For example:
    >>> S.toList_ $ S.mapped S.toList $ S.split 'c' (S.each "abcde")
    ["ab","de"]
    
    maps and mapped obey these rules:
    maps id              = id
    mapped return        = id
    maps f . maps g      = maps (f . g)
    mapped f . mapped g  = mapped (f <=< g)
    maps f . mapped g    = mapped (fmap f . g)
    mapped f . maps g    = mapped (f <=< fmap g)
    
    maps is more fundamental than mapped, which is best understood as a convenience for effecting this frequent composition:
    mapped phi = decompose . maps (Compose . phi)
    

Page 7 of many | Previous | Next