Detection of template haskell can be more precise
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 201
- PR merge metrics
- No merged PRs in 30d
Description
**Shared Program**: https://code.world/haskell#PvmcFl0m1uGPxR-OH8_lVeQ
**Description**
The detection of template-haskell currently just looks for any of "TemplateHaskell", "QuasiQuote" or "glasgow-exts" as a substring of the source file. This isn't saying exactly what we want. In particular:
1. This might not be sufficient in the future to detect all ways to turn on TemplateHaskell. GHC could add new flag sets that have this effect (in the same way that -fglasgow-exts does now).
2. These strings can sometimes occur in comments, string literals, etc., where they are innocent, but the program is rejected anyway.
Copied from a comment on #1072:
> codeworld-compiler now links ghc-lib-parser, and parseDynamicFilePragma can be used to parse language and options pragmas from the source code into dflags, and then we can check for use of the language flags in the resulting DynFlags value. There's existing code for this in CodeWorld.Compile.Framework ghcParseCode.
@misterbeebee FYI
Contributor guide
Assessment
This issue has not been assessed yet.