On 14-May-1998, Philip Wadler <[EMAIL PROTECTED]> wrote:
> Rossberg writes,
>
> > So the x above is always flat already. Wouldn't the equation
> >
> > flatten (x :<|> y) = x
> >
> > suffice? Doing recursion here seems to be unnecessary overhead.
...
> > Am I missing something?
>
> You're not the one who missed something. I didn't spot this
> optimization because I had in mind the case where the user might use
> <|> directly. If we disallow this, your tricky optimisation is quite
> sensible. As it happens, it doesn't seem to improve time or space by
> much, at least for the lazy version. I include modified code below.
Wouldn't it be a good idea for the modified code to actually disallow
the use of <|> directly, then?
A module system that can enforce encapsulation is a wonderful thing.
But of course it can't do any good if no-one uses it! ;-)
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.