HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulemachines-0.7.4Haskell2010

Data.Machine.Runner

  • 7 values
  • Packagemachines-0.7.4
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceRunner.hs
valuefoldrT :: Monad m => (o -> b -> b) -> b -> MachineT m k o -> m b
#

Right fold over a stream. This will be lazy if the underlying monad is.

runT = foldrT (:) []
valuefoldlT :: Monad m => (b -> o -> b) -> b -> MachineT m k o -> m b
#

Strict left fold over a stream.

valuefoldMapT :: (Monad m, Monoid r) => (o -> r) -> MachineT m k o -> m r
#

Strict fold over a stream. Items are accumulated on the right:

... ((f o1 <> f o2) <> f o3) ...

Where this is expensive, use the dual monoid instead.

valuefoldT :: (Monad m, Monoid o) => MachineT m k o -> m o
#

Strict fold over a monoid stream. Items are accumulated on the right:

... ((o1 <> o2) <> o3) ...

Where this is expensive, use the dual monoid instead.

foldT = foldMapT id
valuerunT1 :: Monad m => MachineT m k o -> m (Maybe o)
#

Run a machine with no input until it yields for the first time, then stop it. This is intended primarily for use with accumulating machines, such as the ones produced by fold or fold1

runT1 m = getFirst $ foldMapT (First . Just) (m ~> taking 1)
valuerunT :: Monad m => MachineT m k b -> m [b]
#

Stop feeding input into model and extract an answer

valuerunT_ :: Monad m => MachineT m k b -> m ()
#

Stop feeding input into model, taking only the effects.