google / google/codeworld

Detection of template haskell can be more precise

Abierto
#1,073 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Haskell
Estrellas
1.3k
Forks
201
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza leyendo CodeWorld.Compile.Framework.ghcParseCode y la lógica actual de detección de Template Haskell. Usa parseDynamicFilePragma de ghc-lib-parser para inspeccionar las pragmas de language y options, y luego verifica que la detección se base en los flags analizados en lugar de en subcadenas de comentarios o literales de cadena. Se considera terminado cuando se detectan todas las formas admitidas de habilitar Template Haskell sin rechazar apariciones inocuas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
haskell
Área
compilers
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.