10Pines / pdepreludat

BSD 3-Clause "New" or "Revised" License
24 stars 2 forks source link

Reorganize template to have specs on the same cabal component as library code #34

Closed JuanFdS closed 3 years ago

JuanFdS commented 3 years ago

By moving all the code into one component we avoid problems of dependencies between the components like what we experienced with HLS (needing to build and then restart the haskell language server) and with Simple GHC (having to choose the correct target to get the tests compiling in vscode).

The only thing that the test code does is evaluating the expression correrTests, which actually runs hspec.

There is just one downside which is that running stack ghci shows a bit more stuff in the prompt:

*Spec Library Spec> 
fdodino commented 3 years ago

Esto es para que no se rompa el plugin de Haskell que usa LSP, no? Y para que sigamos teniendo el hie.yaml y no se rompa SimpleGHC? Porque yo localmente si borro el hie.yaml el SimpleGHC funca. Si este cambio permite que convivan ambos plugins, me parece fenómeno. El prompt raro no me preocupa.

JuanFdS commented 3 years ago

Creo que deberia arreglar eso tambien, como era exactamente que fallaba? @fdodino, lo que probe fue: con la version previa al PR y Simple GHC: En Spec.hs, Library falla con

Could not find module ‘Library’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.

Con la version de este PR y Simple GHC Spec.hs encuentre lo mas bien lo que esta en Library.hs y si cambio uno el otro se entera inmediatamente.

La idea del PR mover un paso ese problema: lo que ahora no andaria bien es que si se cambia el nombre de correrTests a otra cosa como runTests ahi hay que recompilar si uno quisiese que vscode marque los errores en CorrerTests.hs. Pero lo unico que hace CorrerTests.hs es evaluar una cosa que exporta Spec.hs, asi que nunca habria que modificarlo.