Proposal: NF newtype

Roman Cheplyaka roma at ro-che.info
Tue Feb 10 18:38:44 UTC 2015


On 10/02/15 19:08, David Feuer wrote:
> +1, generally. Two thoughts:
> 
> 1. There are, as far as I know, two reasonable senses of NF that one
> might care about. The weak sense is a guarantee that the structure has
> no accessible bottoms within it that would be reached if the structure
> were evaluated to normal form, along with a guarantee that it is
> impossible to use it to force lazy IO. A stronger sense offers some
> kind of performance guarantee, which seems much trickier to specify.
> Whether something is *actually* in normal form is not observable
> without using something like ticky-ticky profiling, so I don't think
> we're allowed to care about that. Since I support the idea of
> unsafeMakeNF, and perhaps other special NF-creation functions, I think
> it's important to be clear about just what it's supposed to mean.

Since deepseq is in no way magical, it can't provide any guarantees (you
can define an instance that does whatever it wants).
And neither can NF, being based on deepseq.

All we can say is makeNF = NF . force, by definition.

Roman



More information about the Libraries mailing list