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. mapsExposed :: forall (m :: Type -> Type) f g r . (Monad m, Functor f) => (forall x . () => f x -> g x) -> Stream f m r -> Stream g m r

    streaming Streaming.Internal

    Deprecated: Use maps instead.

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

    streaming Streaming.Internal

    Map layers of one functor to another with a transformation involving the base monad. maps is more fundamental than mapsM, which is best understood as a convenience for effecting this frequent composition:

    mapsM phi = decompose . maps (Compose . phi)
    
    The streaming prelude exports the same function under the better name mapped, which overlaps with the lens libraries.

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

    streaming Streaming.Internal

    Deprecated: Use mapsM instead.

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

    streaming Streaming.Internal

    Map layers of one functor to another with a transformation involving the base monad. mapsMPost is essentially the same as mapsM, but it imposes a Functor constraint on its target functor rather than its source functor. It should be preferred if fmap is cheaper for the target functor than for the source functor. mapsPost is more fundamental than mapsMPost, which is best understood as a convenience for effecting this frequent composition:

    mapsMPost phi = decompose . mapsPost (Compose . phi)
    
    The streaming prelude exports the same function under the better name mappedPost, which overlaps with the lens libraries.

  5. mapsM_ :: (Functor f, Monad m) => (forall x . () => f x -> m x) -> Stream f m r -> m r

    streaming Streaming.Internal

    Map each layer to an effect, and run them all.

  6. mapsPost :: forall (m :: Type -> Type) f g r . (Monad m, Functor g) => (forall x . () => f x -> g x) -> Stream f m r -> Stream g m r

    streaming Streaming.Internal

    Map layers of one functor to another with a transformation. Compare hoist, which has a similar effect on the monadic parameter.

    mapsPost id = id
    mapsPost f . mapsPost g = mapsPost (f . g)
    mapsPost f = maps f
    
    mapsPost is essentially the same as maps, but it imposes a Functor constraint on its target functor rather than its source functor. It should be preferred if fmap is cheaper for the target functor than for the source functor.

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

  8. 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 :> ()
    

  9. 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.

  10. 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.

Page 141 of many | Previous | Next