Patterns annotated with a bang (!
) are evaluated strictly instead of lazily.
foo (!x, y) !z = [x, y, z]
In this example, x
and z
will both be evaluated to weak head normal form before returning the list. It's equivalent to:
foo (x, y) z = x `seq` z `seq` [x, y, z]
Bang patterns are enabled using the Haskell 2010 BangPatterns
language extension.