Proposal: Don't require users to use undefined

Bas van Dijk v.dijk.bas at
Tue Oct 26 14:50:00 EDT 2010

On Tue, Oct 26, 2010 at 8:12 PM, Bulat Ziganshin
<bulat.ziganshin at> 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.

However, my point is that using 'undefined':

* is dangerous because the type checker won't warn you when you
accidentally put 'undefined' in the wrong place,
* is dangerous when you accidentally evaluate the argument in an
instance of Storable,
* is harder to optimize because of the unused argument,
* is only used for type-checking and so why not help the type-checker
by only using a type (Tagged a Int).

Also note that the patches attached to the ticket simplify a lot of
code. See that in most files there are more '-'s than '+'s:

(To be fair, most of these functions could have been written without
using helper functions by using 'forall a. ... sizeOf (undefined ::
a)' directly.)



More information about the Libraries mailing list