Refactoring proposal : yet another move towards cabal

Abierto
#6,593 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
haskell
Área
build-system

Línea de trabajo

Empieza comparando src/Stack/Types/DumpPackage.hs y src/Stack/Types/GhcPkgId.hs con los tipos de Cabal referenciados InstalledPackageInfo, ComponentId y UnqualComponentName. Revisa los cuatro cambios de representación propuestos y sus implicaciones para Backpack. Se considerará terminado cuando exista una dirección acordada para el RFC y se hayan refactorizado de forma coordinada los tipos duplicados, el análisis sintáctico y las representaciones de component-name.

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

Descripción

awaiting review component: backpack component: build type: enhancement

So, while working on backpack related processing, I realized that there are many things that stack duplicate in very slightly different ways from cabal, with no obvious benefit and pretty obvious downsides (such as conversion costs). I've come to a point where I either have to duplicate yet another huge chunk of backpack related logic into Stack because the types differ, or I can try to refactor current duplicates from Stack which make no sense. This would benefit Stack by reducing the amount of conversion and parsing logic done on stack's side (but some conversation will still be needed at places but I'd expect far less than the current state of things). This should also reduce the amount of code in stack at the cost of slightly hampered flexibility and maintenance burden for the imported logic.
This issue is a request for comment for the following refactorings (That I would do if I'm allowed):

  • The entire DumpPackage type and parsing logic is a duplicate of the InstalledPackageInfo in cabal. The parsing function in cabal is expecting strict ByteString whereas the stack one operates on a stream of Text, but I'd expect the transition to be relatively smooth.
  • The GhcPkgId is the mix of many different types in Cabal (but mostly, as of now in stack, it's the mirror of the ComponentId). This is a problem for Backpack because Backpack has a notion of OpenModule (that is component which lacks implementation of its signatures) and this notion is hard to represent correctly with current GhcPkgId type.
  • StackUnqualComponentName should be a newtype over UnqualComponentName from cabal, there are little reasons for not having this and the current Text based version is less efficient than the cabal one.
  • The NamedComponent from Stack should also use the StackUnqualComponentName as the underlying representation for better interop. A Text translating function can be implemented to limit the amount of refactoring needed.

That's it, for now, I believe this is a significant enough refactoring. It would really ease the process for Backpack support.

PS: Not that while Backpack requires component based builds and they incur a significant slowdown compared to package based builds (as explained in #6356), it shouldn't be a problem for now because we'd only enable component based build for backpack packages.

RFC @mpilgrem

Lenguaje dominante
Haskell
Estrellas
4.1k
Forks
857
Merge medio
17 h 32 min
PR fusionados (30 d)
5

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de commercialhaskell/stack

Todos los issues de commercialhaskell/stack

Issues similares

Más issues de Haskell

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.