happy and OPTIONS pragmas

Ian Lynagh igloo at earth.li
Thu Nov 4 13:20:53 EST 2004


Hi,

If I have this at the start of a .x file:

    {
    {-# OPTIONS -w #-}
    module Lexer (lex_tok) where
    }

then the generated .hs file starts:

    {-# OPTIONS -cpp #-}
    {-# LINE 2 "Lexer.x" #-}
    {-# OPTIONS -w #-}
    module Lexer (lex_tok) where

and the warnings are suppressed when I compile my program with
ghc -Wall --make

However, if a .y file starts:

    {
    {-# OPTIONS -w #-}
    -- Foo
    {-# OPTIONS -w #-}
    module Parser (parse) where
    }

then the generated .hs file starts:

    -- parser produced by Happy Version 1.14
    -- Foo
    {-# OPTIONS -w #-}
    module Parser (parse) where

so the pragma before my comment has been eaten and the 2 comments mean
that ghc doesn't see the pragma, so gives me all the warnings anyway.

Can happy be changed so my pragma gets through please?


Thanks
Ian, with happy 1.14



More information about the Glasgow-haskell-users mailing list