Closed Magicloud closed 5 years ago
What is inside exts? There should be the Language Pragmas you use. In your case there should be GADTs inside.
I am not sure if I understand correctly. Since the error message prompted the Language Pragma, I think the line above "module Test" should work?
exts
contains the "default-extensions" from .cabal file, which does not contain GADTs since GADTs only being used in this module.
Okay so you have to include GADTs. With extensions = exts you tell haskell-src-exts which Language Pragmas it should parse. So in your case exts should be [LambdaCase, GADTs].
I see. So if the input (module Test) is unknown when I write the parser code, I have to enable all extensions?
Yes you can enable all via extensions = [EnableExtension x | x <- [minBound..maxBound]] if you import Language.Haskell.Exts.Extension
OK. Thank you. Did not know Language Pragma does not work for HSE.
I have checked prompted issues, do not seem like the same issue.
I have a module using GADTs extension enabled by LANGUAGE pragma. And LambdaCase enabled by Cabal default-extensions.
Then following parsing code gave me error.
Test module works with GHC 8.6.3. haskell-src-exts is 1.20.3.