HORIZON HASKELLDocslts/ghc-9.14.x99ffbb82026-10-19Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 99ffbb8 · 2026-10-19

Modulemachines-0.7.4Haskell2010

Data.Machine.Runner

Synopsis
  • 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 (:) []
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)