GHC (without -XBangPatterns) silently accepts bang patterns in outermost position
GHC 6.8, 6.12, 7.0 at least accept bang patterns on the outside of patterns silently.
main = do
let !x = 1
return ()
I expect an "illegal bang pattern" error, but it is accepted:
$ ghci A.hs
GHCi, version 7.0.0.20101028: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main ( A.hs, interpreted )
Ok, modules loaded: Main.
However, if we move it inside some parens, it correctly fails:
main = do
let (!x) = 1
return ()
failing with
A.hs:2:10:
Illegal bang-pattern (use -XBangPatterns):
! x
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.1 RC1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |
Edited by isaacdupree