Bang patterns

Ben Millwood haskell at
Tue Feb 5 01:24:51 CET 2013

On Mon, Feb 04, 2013 at 01:21:31PM -0800, Johan Tibell wrote:
>On Sun, Feb 3, 2013 at 4:44 PM, Ben Millwood <haskell at> wrote:
>> I have two proposals, I suppose:
>> - make bang patterns in let altogether invalid
>I would prefer it to be valid. It's the syntactically most lightweight
>option we have to force some thunks before using the resulting values
>in a constructor that we have. Example
>    let !x = ...
>        !y = ...
>    in C x y
>The alternative would be
>    let x = ...
>        y = ...
>    in x `seq` y `seq` C x y
>which obscures the code much more.

I'd write (C $! x) $! y. We could devise a left-associative $! to avoid 
the use of parentheses here. But my objection was only ever a mild 
unease in any case, so I'm happy to dismiss it.


More information about the Haskell-prime mailing list