2 ms·
> a stack of wrappers with the data buried at the bottom Yes, 'Delay t' stores a value "at the end" (in the 'Now' constructor), but doesn't store anything "on
by chriswarbo 4y ago
> a stack of wrappers with the data buried at the bottom
Yes, 'Delay t' stores a value "at the end" (in the 'Now' constructor), but doesn't store anything "on the way" (in the 'Later' constructor).
In contrast, 'List t' stores values "on the way" (in Cons), but doesn't store anything "at the end" (in Nil).
Another useful example is (Peano) natural numbers, which don't store any values "at the end" (Zero) or "on the way" (Successor).
Natural numbers are isomorphic to 'List ()' and 'Delay ()' (whose 'elements' contain no information)
> Lists have a consumable head
Slight nit-pick: only non-empty lists have a head. Non-empty lists are isomorphic to '(t, List t)'.
Consuming the head of a 'Delay t' is still useful, since they act like a counter; or (equivalently) as a notion of logical time.
I find this stuff fascinating, and explored it in more detail at http://www.chriswarbo.net/blog/2014-12-04-Nat_like_types.html http://www.chriswarbo.net/blog/2014-12-04-Nat_like_types.htm...