Hi Simon,

I found a bug in alex-3.0 and I'm attaching a fixed source file -
templates/wrappers.hs (modified against alex-3.0 from cabal unpack).


Explanation:
I was installing bytestring-lexing 0.2.1 and it failed to install with
alex 3.0, which was released on Aug 4.
It succeeded, however, with the most recent earlier alex 2.3.5.

Turns out that the wrapper for lazy bytestrings (strict are ok) had
alexGetByte not doing w2c conversion:
alexGetByte (_, cs) | ByteString.null cs = Nothing
                    | otherwise          = Just (ByteString.head cs,
(ByteString.head cs, ByteString.tail cs))

It should say ByteString.w2c $ ByteString.head cs here.
With this and an additional import of Data.ByteString.Internal (w2c),
the generated code compiles.

To reproduce, cabal unpack bytestring-lexing and try installing it.
Installation will fail, then manually alex the .x files in
Data/ByteString/Lex{,/Lazy} and try ghci'ing to them, doing the
modification I did and ghci'ing again.



-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

Attachment: wrappers.hs
Description: Binary data

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to