Proposal: Don't require users to use undefined

Henning Thielemann schlepptop at henning-thielemann.de
Tue Oct 26 15:20:05 EDT 2010


Bas van Dijk schrieb:
> On Tue, Oct 26, 2010 at 8:12 PM, Bulat Ziganshin
> <bulat.ziganshin at gmail.com> wrote:
>>> I find the use of 'undefined' ugly
>> yu aren't groked lazy evaluation :)
> 
> I know that 'sizeOf (undefined :: Word8)' will never evaluate the
> 'undefined' due to laziness and is completely safe.

It's pretty easy to be too strict accidentally:

sizeOf (a,b) = sizeOf a + sizeOf b

Instead you have to write

sizeOf ~(a,b) = sizeOf a + sizeOf b

(Replace (,) with any other data constructor.)



More information about the Libraries mailing list