[Pkg-haskell-maintainers] Bug#635113: Generated code fails to compile: uses bang patterns without corresponding {-# LANGUAGE BangPatterns #-} pragma

Josh Triplett josh at joshtriplett.org
Sat Jul 23 05:25:36 UTC 2011

On Sat, Jul 23, 2011 at 11:26:10AM +1000, Erik de Castro Lopo wrote:
> Josh Triplett wrote:
> > That looks like Alex's own lexer, used to build Alex; adding
> > BangPatterns there seems like the wrong fix, and it *only* fixes Alex
> > itself, not other users of Alex. 
> Ah, right. 
> > Instead, Alex should automatically add
> > {-# LANGUAGE BangPatterns #-} to the generated lexer (or rather, extend
> > the existing LANGUAGE pragma to include BangPatterns) when it uses
> > BangPatterns (specifically, when using -g).  That would avoid forcing
> > the project that uses Alex to know that it needs BangPatterns
> > internally.
> Ok, I'll purse that issue.


> > Projects using Cabal automatically invoke alex with -g when building
> > with GHC, so this change breaks any project using Cabal and Alex (or any
> > other project using -g).  A quick search turns up various build logs
> > (from Debian packages and otherwise) of lexers failing to build with
> > this error.
> > 
> > Also, I hope that the fixed version of this patch can go upstream to fix
> > other users of alex, since otherwise a project building on Debian and
> > using -Wall -Werror will fail to build when not using Debian alex.
> I have definitely tried:
>     http://trac.haskell.org/haskell-platform/ticket/141
>     http://trac.haskell.org/haskell-platform/ticket/171
> Apparently this will be fixed in ghc-7.2 which should be released
> around september this year.

Looking at those tickets, upstream seems to have wontfixed the idea of
using OPTIONS_GHC to turn off the GHC warning (which will go away in
7.2), but I don't see any consideration of the idea of just adding the
bang patterns and using BangPatterns.  GHC has supported the
BangPatterns extension since at least 6.6 if not older.

- Josh Triplett

More information about the Pkg-haskell-maintainers mailing list