Constraints on definition of `length` should be strengthened

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Mon Apr 10 09:28:43 UTC 2017


Sven Panne <svenpanne at gmail.com> writes:

> And even if there are laws which hold for those instances, it doesn't mean
> that these instances should be defined. Take e.g. Bool: One can define a
> "Num Bool" instance which respects the usual laws (interpreting Bool
> basically as a "Word1", just like Word32 etc.), but we do *not* want to
> have this in the standard language/libraries, and for a good reason: It
> would make types less useful, removing a part of the usual "If it compiles,
> it works" safety net...

Most heartily agree. Probably the programmer’s most important
use of a static type system is to catch errors at compile time.

I sit next to someone who is obliged to use scripting languages
that automatically convert things to numbers whether you want
that or not. This has several times produced hard to find bugs,
and so cost real money.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Libraries mailing list