Proposal: Add an analogue of $! to deepseq

Ivan Lazar Miljenovic ivan.miljenovic at
Fri Jul 15 00:49:11 CEST 2011

It's been two weeks since I raised this, and as such discussion time
is over.  For the complete discussion, please see

In total, there were five respondees.

On 1 July 2011 17:55, Ivan Lazar Miljenovic <ivan.miljenovic at> wrote:
> I propose we add a operator - tentatively labelled $!! (and which
> Hayoo reports isn't currently exported by a Hackage package) - as a
> deepseq analogue $! to the deepseq library:
> ($!!) :: (NFData a) => (a -> b) ->a -> b
> f $!! x = x `deepseq` f x
> infixr 0 $!!

All respondees agreed with this proposal; as such it passes.

> As a sub-proposal, I also propose that we add a "force" function (the
> name of which also seems to be unused) to make it easier to test
> forcing of values:
> force :: (NFData a) => a -> a
> force x = x `deepseq` x

* Two people agreed with this proposal.

* Two people indicated that it may produce confusing results (one of
which at least can be seen as a vote against this proposal),

* The fifth respondee didn't mention it.

As such, including myself in the tally, I would consider that this
proposal passes, but that we should add sufficient documentation to
cover Malcolm's and Sebastian's concerns (specifically that using
force inside a left-fold would actually be more analogous to foldl
than foldl', and that a reminder should be made that this will
evaluate the value to NF rather than HNF, which is indeed the point).

I will now go and create a ticket on the GHC Trac.

@Simon: as the maintainer of deepseq, would you prefer I create a
patch with these changes, or will you do so yourself?

Ivan Lazar Miljenovic
Ivan.Miljenovic at

More information about the Libraries mailing list