I was looking through some notes, and I realized that something was wrong.
When emulating lazy calculations (without open Lazy;) for the flow from them, the following can be done.
datatype 'a susp = Susp of (unit -> 'a)
datatype 'a stream' = Cons of 'a * ('a stream') susp
type 'a stream = ('a stream') susp
fun delay (f ) = Susp(f);
fun force (Susp(f)) = f ();
val rec ones' = fn () => Cons(1, delay(ones'));
val ones = delay(ones')
fun ltail(Susp(s)) = ltail'(force s)
and ltail' (Cons(x,s)) = s
But to get a suspended tail, the types do not match.
operator domain: 'Z susp
operand: unit -> 'Y
What needs to be changed for the correct types for stail? I know what happens when the tail is not paused. I just want to find out what notes for the paused version say.
source
share