tomberek wrote: > Everything up until here was good. (Brand new Arch with everything > updated) Then at Lexer.hs:
Yeah, this is a alex bug which won't be fixed: http://trac.haskell.org/haskell-platform/ticket/171 You have two options: a) Remove -Werror from the build system, but then you need to make sure you re-enable it if you are creating patches push to the repo. b) Compile src/Source/Lexer.hs by hand dropping the -Werror (with this solution everything else still gets compiled with that flag). c) Patching alex. This is the route I have taken and this is the patch that is in Debian's version of alex. Patch below. Cheers, Erik # Author : Erik de Castro Lopo # Description : Fix generated haskell code so it doesn't fail with -Werror. # Debian Version : 2.3.5 # Date : Sun, 17 Apr 2011 15:45:41 +1000 Index: alex-2.3.5/templates/GenericTemplate.hs =================================================================== --- alex-2.3.5.orig/templates/GenericTemplate.hs +++ alex-2.3.5/templates/GenericTemplate.hs @@ -9,7 +9,7 @@ #ifdef ALEX_GHC #define ILIT(n) n# -#define FAST_INT_BINDING(n) (n) +#define FAST_INT_BINDING(n) (!(n)) #define IBOX(n) (I# (n)) #define FAST_INT Int# #define LT(n,m) (n <# m) @@ -57,10 +57,10 @@ ALEX_IF_BIGENDIAN narrow16Int# i where - i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low) - high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) - low = int2Word# (ord# (indexCharOffAddr# arr off')) - off' = off *# 2# + !i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low) + !high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) + !low = int2Word# (ord# (indexCharOffAddr# arr off')) + !off' = off *# 2# ALEX_ELSE indexInt16OffAddr# arr off ALEX_ENDIF @@ -74,14 +74,14 @@ ALEX_IF_BIGENDIAN narrow32Int# i where - i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#` + !i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#` (b2 `uncheckedShiftL#` 16#) `or#` (b1 `uncheckedShiftL#` 8#) `or#` b0) - b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#))) - b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#))) - b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) - b0 = int2Word# (ord# (indexCharOffAddr# arr off')) - off' = off *# 4# + !b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#))) + !b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#))) + !b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) + !b0 = int2Word# (ord# (indexCharOffAddr# arr off')) + !off' = off *# 4# ALEX_ELSE indexInt32OffAddr# arr off ALEX_ENDIF Index: alex-2.3.5/src/Scan.x =================================================================== --- alex-2.3.5.orig/src/Scan.x +++ alex-2.3.5/src/Scan.x @@ -11,7 +11,7 @@ ------------------------------------------------------------------------------- { -{-# OPTIONS_GHC -w #-} +{-# OPTIONS_GHC -w -XBangPatterns #-} module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where Index: alex-2.3.5/src/Main.hs =================================================================== --- alex-2.3.5.orig/src/Main.hs +++ alex-2.3.5/src/Main.hs @@ -184,7 +184,7 @@ hPutStrLn hdl code optsToInject :: Target -> [CLIFlags] -> String -optsToInject GhcTarget _ = "{-# LANGUAGE CPP,MagicHash #-}\n" +optsToInject GhcTarget _ = "{-# LANGUAGE CPP,MagicHash,BangPatterns #-}\n" optsToInject _ _ = "{-# LANGUAGE CPP #-}\n" importsToInject :: Target -> [CLIFlags] -> String -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ -- Disciple-Cafe mailing list http://groups.google.com/group/disciple-cafe
