UTF-8 and text 2.0
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Comienza con el comportamiento documentado de alexGetByte y los wrappers existentes descritos en el issue, y después compara cómo manejan los tipos Haskell String, ByteString y text 2.0 Text. Aclara si el objetivo son nuevos wrappers de UTF-8 para Text o una interfaz basada en alexGetChar; el issue no define una implementación específica ni una prueba de finalización.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
As the documentation says, Alex works over a stream of UTF-8 encoded bytes, retrieved one at a time by alexGetByte.
Lexer specifications are written in terms of Unicode characters, but Alex works internally on a UTF-8 encoded byte sequence.
Depending on how you use Alex, the fact that Alex uses UTF-8 encoding internally may or may not affect you. If you use one of the wrappers (below) that takes input from a Haskell String, then the UTF-8 encoding is handled automatically. However, if you take input from a ByteString, then it is your responsibility to ensure that the input is properly UTF-8 encoded.
From an external viewpoint as a consumer (I am not familiar with how Alex is implemented), this seems like a strange design decision to me. If my source is already in a UTF-8 format like String or Data.Text(.Lazy).Text (with the new text 2.0 release), it seems that in order to run Alex on it, I (or a wrapper) would have to write logic to decode the UTF-8 content into individual bytes, just so that Alex can immediately re-encode it back into UTF-8 internally.
So I'm wondering if there's a reason that Alex needs to work over bytes and not Chars, or if that was perhaps done to support lexing ByteStrings directly, without having to first unpack the data into UTF-8 Strings or decode into UTF-16 Texts (with text <2.0), which would be unnecessary overhead either way.
If Alex has to work over bytes for internal reasons, I think it would be a good idea to implement new wrappers for the UTF-8 Text types, since I'd imagine that would be a pretty common use case.
Otherwise, would it be possible to expose an alexGetChar-based interface that simply skips the UTF-8 decoding portion of Alex's internal logic, which would be more ergonomic and efficient for UTF-8 based types?
- Lenguaje dominante
- Haskell
- Estrellas
- 323
- Forks
- 87
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de haskell/alex
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
-
Is module DFS really needed?Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Agda-style LexingAbiertodiscussion
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
Todos los issues de haskell/alex
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
haskell/bytestring#730 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
seal-harness/seal-harness#399 ·
Los mantenedores suelen responder en 1 día
-
add previously overlooked rulesAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
fmidue/codeworld-tasks#124 ·
-
allow haskell-src-exts-1.24Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
reflex-frp/reflex#563 ·