HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulererebase-1.21.2Haskell2010

Data.Vector.Fusion.Stream.Monadic

  • 4 types
  • 113 values
  • Packagererebase-1.21.2
  • Exports117
  • LanguageHaskell2010
  • LicenceMIT
  • SourceMonadic.hs
valuefoldlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a
#

Left fold with a monadic operator

valuefoldrM :: Monad m => (a -> b -> m b) -> b -> Stream m a -> m b
#

Right fold with a monadic operator

valuemapM_ :: Monad m => (a -> m b) -> Stream m a -> m ()
#

Execute a monadic action for each element of the Stream

valuefoldl1' :: Monad m => (a -> a -> a) -> Stream m a -> m a
#

Left fold over a non-empty Stream with a strict accumulator

valuescanl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> Stream m a
#

Haskell-style scan with strict accumulator

valuefoldl' :: Monad m => (a -> b -> a) -> a -> Stream m b -> m a
#

Left fold with a strict accumulator

valuefoldr1 :: Monad m => (a -> a -> a) -> Stream m a -> m a
#

Right fold over a non-empty stream

datadata SPEC
#

SPEC is used by GHC in the SpecConstr pass in order to inform the compiler when to be particularly aggressive. In particular, it tells GHC to specialize regardless of size or the number of specializations. However, not all loops fall into this category.

Libraries can specify this by using SPEC data type to inform which loops should be aggressively specialized. For example, instead of

loop x where loop arg = ...

write

loop SPEC x where loop !_ arg = ...

There is no semantic difference between SPEC and SPEC2, we just need a type with two constructors lest it is optimised away before SpecConstr.

This type is reexported from GHC.Exts since GHC 9.0 and base-4.15. For compatibility with earlier releases import it from GHC.Types in ghc-prim package.

valuefoldlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> m a
#

Left fold with a strict accumulator and a monadic operator

datadata Step s a where
#

Result of taking a single step in a stream

Constructors

Instances1Functor
  • Functor (Step s)Defined in vector-stream-0.1.0.1 · Data.Stream.Monadic
valueiterateN :: Monad m => Int -> (a -> a) -> a -> Stream m a
#

O(n) Apply function \max(n - 1, 0) times to an initial value, producing a stream of \max(n, 0) values.

valueslice
  1. :: Monad m
  2. => Int

    starting index

  3. -> Int

    length

  4. -> Stream m a
  5. -> Stream m a
#

Extract a substream of the given length starting at the given position.

datadata Box a
#

Box monad

Constructors

Instances3Monad, Functor, Applicative
  • Monad BoxDefined in vector-stream-0.1.0.1 · Data.Stream.Monadic
  • Functor BoxDefined in vector-stream-0.1.0.1 · Data.Stream.Monadic
  • Applicative BoxDefined in vector-stream-0.1.0.1 · Data.Stream.Monadic
valueprescanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a
#

Prefix scan with strict accumulator and a monadic operator

valuescanl1M' :: Monad m => (a -> a -> m a) -> Stream m a -> Stream m a
#

Initial-value free scan over a Stream with a strict accumulator and a monadic operator

valueiterateNM :: Monad m => Int -> (a -> m a) -> a -> Stream m a
#

O(n) Apply monadic function \max(n - 1, 0) times to an initial value, producing a stream of \max(n, 0) values.

valuescanlM :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a
#

Haskell-style scan with a monadic operator

valuescanlM' :: Monad m => (a -> b -> m a) -> a -> Stream m b -> Stream m a
#

Haskell-style scan with strict accumulator and a monadic operator