
On 25.11.2015 20:38, David Kraeutmann wrote:
I'm not quite sure I understand the purpose of this structure. As far as I can tell, it's isomorphic to list (even under laziness) with some minor differences in performance characteristics (determining whether a cons cell is terminal requires evaluating the subsequent list to WHNF, whereas in your structure it follows from the constructor. But I think that's just a minor performance detail).
I think you misunderstand the structure. It is just a list that has an element of a type t at the end. It might not terminate. data List t e = Cons e (List t e) | Null | Terminal t data List t e = Cons e (List t e) | Null t are somewhat similar to ([e],Maybe t) ([e],t) respectively. but it is guaranteed that all cons of [e] are evaluated before t can be touched. Silvio