[Haskell-cafe] Alex -g

Max Bolingbroke batterseapower at hotmail.com
Sun Feb 20 21:20:55 CET 2011


On 20 February 2011 19:56, Mihai Maruseac <mihai.maruseac at gmail.com> wrote:
> Hi,
>
> When running Alex -g I get several warning telling me that a bang
> pattern is required and that the warning will be an error in GHC 6.14.

As it happens, that is not an error in GHC 7 (see
http://hackage.haskell.org/trac/ghc/ticket/3278):

"""
$ ghci -XMagicHash
GHCi, version 7.0.1.20101215: http://www.haskell.org/ghc/  :? for help
letLoading package ghc-prim ... linking ...  done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... xdone.
Loading package ffi-1.0 ... linking ... done.
Prelude> let x = 2# in 10

<interactive>:1:5:
    Warning: Bindings containing unlifted types should use an
outermost bang pattern:
               x = 2#
    In the expression: let x = 2# in 10
    In an equation for `it': it = let x = 2# in 10

<interactive>:1:5:
    Warning: Bindings containing unlifted types should use an
outermost bang pattern:
               x = 2#
    In the expression: let x = 2# in 10
    In an equation for `it': it = let x = 2# in 10
10
"""

(I'm not quite sure why I get two identical warnings..)

It looks like Alex has gone back and forth on what to do here. Selected commits:

"""
Fri Nov 26 10:43:42 GMT 2010  Simon Marlow <marlowsd at gmail.com>
  * don't use CPP for LANGUAGE pragmas
  Drop the -fno-warn-lazy-unlifted-bindings again.  CPP in the header
  prevents the user from adding their own LANGUAGE pragmas at the top of
  the .x file if they're using GHC < 7.0.

Wed Nov 17 10:42:23 GMT 2010  Simon Marlow <marlowsd at gmail.com>
  * Stop using -fglasgow-exts, and turn off bogus bang-pattern warnings

Wed Nov 17 10:41:06 GMT 2010  Simon Marlow <marlowsd at gmail.com>
  * remove bang patterns on unlifted bindings again

Wed Jun  3 23:58:54 BST 2009  Ian Lynagh <igloo at earth.li>
  * Use bang patterns on unlifted bindings
"""

So it looks like you should just ignore this warning, or turn it off :-)

Max



More information about the Haskell-Cafe mailing list