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

  • 3 types
  • 10 values
  • Packagemachines-0.7.4
  • Exports13
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTee.hs

Tees

13 declarations
typetype Tee a b c = Machine (T a b) c
#

A Machine that can read from two input stream in a deterministic manner.

typetype TeeT (m :: Type -> Type) a b c = MachineT m (T a b) c
#

A Machine that can read from two input stream in a deterministic manner with monadic side-effects.

datadata T a b c where
#

The input descriptor for a Tee or TeeT

Constructors

  • L :: T a b a
  • R :: T a b b
valuetee
  1. :: Monad m
  2. => ProcessT m a a'
  3. -> ProcessT m b b'
  4. -> TeeT m a' b' c
  5. -> TeeT m a b c
#

Compose a pair of pipes onto the front of a Tee.

Examples:

Example2 expressions
import Data.Machine.Sourcerun $ tee (source [1..]) (source ['a'..'c']) zipping[(1,'a'),(2,'b'),(3,'c')]
valueteeT
  1. :: Monad m
  2. => TeeT m a b c
  3. -> MachineT m k a
  4. -> MachineT m k b
  5. -> MachineT m k c
#

`teeT mt ma mb` Use a Tee to interleave or combine the outputs of ma and mb.

The resulting machine will draw from a single source.

Examples:

Example2 expressions
import Data.Machine.Sourcerun $ teeT zipping echo echo <~ source [1..5][(1,2),(3,4)]
valuecapT :: Monad m => SourceT m a -> SourceT m b -> TeeT m a b c -> SourceT m c
#

Tie off both inputs to a tee by connecting them to known sources. This is recommended over capping each side separately, as it is far more efficient.

valuezipWithT :: (a -> b -> c) -> PlanT (T a b) c m ()
#

wait for both the left and the right sides of a T and then merge them with f.

valuezipWith :: (a -> b -> c) -> Tee a b c
#

Zip together two inputs, then apply the given function, halting as soon as either input is exhausted. This implementation reads from the left, then the right

valuezipping :: Monad m => MachineT m (T a b) (a, b)
#

Zip together two inputs, halting as soon as either input is exhausted.