Bang patterns

Simon Marlow marlowsd at
Thu Feb 7 13:24:48 CET 2013

On 04/02/13 23:42, Ian Lynagh wrote:
> On Mon, Feb 04, 2013 at 10:37:44PM +0000, Simon Peyton-Jones wrote:
>> I don't have a strong opinion about whether
>> 	f ! x y ! z = e
>> should mean the same; ie whether the space is significant.   I think it's probably more confusing if the space is significant (so its presence or absence makes a difference).
> I also don't feel strongly, although I lean the other way:
> I don't think anyone writes "f ! x" when they mean "f with a strict
> argument x", and I don't see any particular advantage in allowing it.
> In fact, I think writing that is less clear than "f !x", so there is an
> advantage in disallowing it.
> It also means that existing code that defines a (!) operator in infix
> style would continue to work, provided it puts whitespace around the !.

FWIW, I really dislike whitespace-significant syntax.  f ! x should mean 
the same as f !x.  Look at the trouble we have with qualified operators: 
how many people have tried to write [Monday..] and been surprised that 
it doesn't work?

So I don't mind at all if BangPatterns makes it harder to write a 
definition of '!', because it's much more common to write bang patterns 
than it is to define '!', and the workaround of writing (!) is not that 

Aside from preferring not to change the lexical syntax, I don't have a 
strong opinion. Your original third option, treating ! and ~ the same 
way, looks ok to me, but I also like the idea of only allowing bang 
patterns where they make sense (variables and pattern bindings).


More information about the Haskell-prime mailing list