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

Andrew Coppin andrewcoppin at btinternet.com
Sun Nov 18 14:04:15 EST 2007

Lauri Alanko wrote:
> Please note that if you're using GHC, bang patterns are often much
> more convenient than $! or seq when you want to enforce strictness:
> http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html

Wait, so...

  f x = x + 1; f $! (a + b)


  f !x = x + 1; f (a + b)

mean the same thing?

Well, you learn something new every day... (I guess wanting a function's 
arguments to evaluate before the rest of that function is quite a common 
thing to want. Neat!)

More information about the Haskell-Cafe mailing list