[Haskell-cafe] What is the role of $!?

Derek Elkins derek.a.elkins at gmail.com
Wed Nov 14 19:35:57 EST 2007

On Wed, 2007-11-14 at 16:27 -0800, Justin Bailey wrote:
> It's:
>   f $! x = x `seq` f x
> That is, the argument to the right of $! is forced to evaluate, and
> then that value is passed to the function on the left. The function
> itself is not strictly evaluated (i.e., f x) I don't believe.

Application is strict so f is forced and id is strict so f x is forced.

More information about the Haskell-Cafe mailing list