
23 Oct
2009
23 Oct
'09
7:59 a.m.
Bas van Dijk wrote:
1) What's the difference between your: "tail ~(Cons _ xs) = xs" and the more simple: "tailStrict (Cons _ xs) = xs" ?
I know they're desugared to: "tail ys = let Cons _ xs = ys in xs" and: "tailStrict ys = case ys of Cons _ xs -> xs" respectively.
But aren't they operationally the same:
"tail undefined = undefined" and: "tailStrict undefined = undefined"
I concur, a strict tail is enough. Writing foo xs = bar (tail xs) has the same effect as foo xs = bar (tailStrict xs) since the evaluation of xs is deferred in both cases. Regards, apfelmus -- http://apfelmus.nfshost.com