[Haskell-cafe] Re: ANN: Data.Stream 0.4
apfelmus at quantentunnel.de
Fri Oct 23 03:59:27 EDT 2009
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"
> "tailStrict ys = case ys of Cons _ xs -> xs" respectively.
> But aren't they operationally the same:
> "tail undefined = undefined"
> "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.
More information about the Haskell-Cafe