Detection of template haskell can be more precise
- Vorherrschende Sprache
- Haskell
- Sterne
- 1.3k
- Forks
- 201
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**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
Beitragsleitfaden
Rechercherichtung
Beginne mit dem Lesen von CodeWorld.Compile.Framework.ghcParseCode und der aktuellen Erkennungslogik für Template Haskell. Verwende ghc-lib-parser's parseDynamicFilePragma, um language- und options-Pragmas zu untersuchen, und überprüfe anschließend, dass die Erkennung auf den geparsten flags basiert und nicht auf Teilzeichenfolgen in Kommentaren oder String-Literalen. Erledigt ist die Aufgabe, wenn alle unterstützten Möglichkeiten zum Aktivieren von Template Haskell erkannt werden, ohne harmlose Vorkommen zurückzuweisen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- haskell
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100