Add Ord Laws to next Haskell Report

Sven Panne svenpanne at gmail.com
Thu Feb 7 17:04:51 UTC 2019


Am Do., 7. Feb. 2019 um 17:22 Uhr schrieb Henning Thielemann <
lemming at henning-thielemann.de>:

> [...] What about calling into foreign code? If I call a BLAS routine and
> one
> element of the result vector is NaN, shall this be trapped? Or shall it be
> trapped once I access the NaN element?
>

IMHO this is the biggest show stopper for some exotic NaN handling, as
correct as it may be mathematically or aesthetically: The floating point
environment is a thread-local (i.e. basically global) entity on most
platforms, and most programming language runtimes expect a "default"
environment, i.e. no traps when NaNs are encountered. So if Haskell wants
to do things differently, the FPE has to be set/reset around foreign calls
and for around every Haskell callback. I am not sure if this is really
worth the trouble and the performance loss. For some special applications
it might be OK or even important, but my gut feeling is that trapping NaNs
is the wrong default in our current world...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190207/b16c8fc6/attachment.html>


More information about the Libraries mailing list