Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLR: generated file *Data.hs doesn't declare its OPTIONS and LANGUAGE pragmas #183

Open
andreasabel opened this issue Feb 14, 2021 · 0 comments

Comments

@andreasabel
Copy link
Member

The GLR generated file *Data.hs doesn't declare its OPTIONS and LANGUAGE pragmas.

Suggestion: Emit the following in the preamble when generating this file:

{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}

{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}

Details

I am getting errors like:

    • Illegal instance declaration for ‘TreeDecode String’
        (All instance types must be of the form (T t1 ... tn)
         where T is not a synonym.
         Use TypeSynonymInstances if you want to disable this.)

    • Illegal instance declaration for ‘TreeDecode [AbsAlfa.Decl]’
        (All instance types must be of the form (T a1 ... an)
         where a1 ... an are *distinct type variables*,
         and each type variable appears at most once in the instance head.
         Use FlexibleInstances if you want to disable this.)

With -Wall I am getting warnings like:

ParTestData.hs:16:1: error: [-Wunused-imports, -Werror=unused-imports]
    The qualified import of ‘Data.Array’ is redundant
      except perhaps to import instances from ‘Data.Array’
    To import instances alone, use: import Data.Array()
   |
16 | import qualified Data.Array as Happy_Data_Array
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParTestData.hs:17:1: error: [-Wunused-imports, -Werror=unused-imports]
    The qualified import of ‘Data.Bits’ is redundant
      except perhaps to import instances from ‘Data.Bits’
    To import instances alone, use: import Data.Bits()
   |
17 | import qualified Data.Bits as Bits
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParTestData.hs:18:1: error: [-Wunused-imports, -Werror=unused-imports]
    The import of ‘Control.Applicative’ is redundant
      except perhaps to import instances from ‘Control.Applicative’
    To import instances alone, use: import Control.Applicative()
   |
18 | import Control.Applicative(Applicative(..))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParTestData.hs:19:1: error: [-Wunused-imports, -Werror=unused-imports]
    The import of ‘Control.Monad’ is redundant
      except perhaps to import instances from ‘Control.Monad’
    To import instances alone, use: import Control.Monad()
   |
19 | import Control.Monad (ap)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

templates/GLR_Base.hs:53:10: error: [-Wunused-matches, -Werror=unused-matches]
    Defined but not used: ‘i’

templates/GLR_Base.hs:68:1: error: [-Wmissing-signatures, -Werror=missing-signatures]
    Top-level binding with no type signature:
      cross_fn :: Monad m => [m (t -> b)] -> [m t] -> [m b]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant