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

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

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

    streaming Streaming.Prelude

    A version of mapped that imposes a Functor constraint on the target functor rather than the source functor. This version should be preferred if fmap on the target functor is cheaper.

  4. maps :: 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.Prelude

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

    maps id = id
    maps f . maps g = maps (f . g)
    

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

    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.

  6. mapFields :: forall c (ts :: [(Symbol, Type)]) . RecMapMethod c ElField ts => (forall a . c a => a -> a) -> FieldRec ts -> FieldRec ts

    vinyl Data.Vinyl

    Apply a typeclass method to each field of a FieldRec. This is a specialization of rmapMethod.

  7. mapFields :: forall c (ts :: [(Symbol, Type)]) . RecMapMethod c ElField ts => (forall a . c a => a -> a) -> FieldRec ts -> FieldRec ts

    vinyl Data.Vinyl.Class.Method

    Apply a typeclass method to each field of a FieldRec. This is a specialization of rmapMethod.

  8. mapMaybe :: Filterable f => (a -> Maybe b) -> f a -> f b

    witherable Witherable

    Like mapMaybe.

  9. mapStateVar :: (b -> a) -> (a -> b) -> StateVar a -> StateVar b

    StateVar Data.StateVar

    Change the type of a StateVar

  10. mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])

    base-compat-batteries Control.Monad.Compat

    The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. This function is mainly used with complicated data structures or a state monad.

Page 142 of many | Previous | Next