Haskell pattern matching too strict?

Robert F. Pointon rpointon at cee.hw.ac.uk
Wed Jan 10 09:45:34 EST 2001


>OTOH evaluation of the argument early may improve performance. Usually
>the purpose of writing a pattern in a function's parameter is to use
>components of the value in its rhs, such that the value of the rhs is
>meaningless without all the components. If the argument matched early,
>the compiler can determine that the function is strict and generate more
>efficient code for calling it.
>
>In rare cases when the body makes sense without some components of
>parameters, you can use lazy patterns or let or functions like head
>instead of pattern matching or whatever.
>
>-- 
>Marcin 'Qrczak' Kowalczyk

Hi,

The argument that efficency/performance is more important that an
evaluation mechanism with constant behaviour is a bit worrying...  

Haskell... <sigh>...    :)

cheers,

___                 
][_)              | +44 (0)131 451 3328
]| \obert Pointon | http://www.cee.hw.ac.uk/~rpointon
------------------+------------------------------
Dept of Computing & Electrical Eng.
Heriot-Watt University
Riccarton
Edinburgh, EH14 4AS






More information about the Glasgow-haskell-bugs mailing list