Ord methods are surprisingly strict

Sven Panne svenpanne at gmail.com
Fri May 8 12:50:25 UTC 2020


Am Fr., 8. Mai 2020 um 12:56 Uhr schrieb Simon Jakobi <
simon.jakobi at googlemail.com>:

> [...] What's still unclear to me is whether library authors are expected to
> follow the same strictness semantics in their Ord instances. For
> example, if I were to expose my Const type with its lazy Ord instance
> from a library, would that be surprising for users of the library?
>

IMHO it would be a bit surprising, as a general rule of thumb: Everything
which is done differently from the way base/Prelude does it is surprising.
It's not necessarily wrong, but at least it needs some prominent
documentation, including the reasoning behind it.


> Could someone illustrate in what kind of issues the reduced strictness
> might manifest?
>

In short:

   * too strict: non-termination
   * too lazy: space leaks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200508/1dd60793/attachment.html>


More information about the Libraries mailing list