def Source.host

bend-trace-context@0.2.0.0 · generation.bend:28

import bend-trace-context@0.2.0.0/generation.bend as Generation
import Base
import bend-trace-context@0.2.0.0/entropy.bend as Entropy

28# The host source as the machine reads it: each read returns one word result
29# from Entropy.read_u32, and the state is Unit because the host keeps none.
30def Source.host(state: Unit) -> IO(Unit & Result<&1, &1, U32 & String, U32>):
31  IO.bind(Result<&1, &1, U32 & String, U32>, Unit & Result<&1, &1, U32 & String, U32>,
32    Entropy.read_u32(), word => IO.pure(Unit & Result<&1, &1, U32 & String, U32>, (state, word)))

Uses (10)

Used by (9)