nmattia / snack

Nix-based incremental build tool for Haskell projects
334 stars 25 forks source link

Add Ghci options #163

Closed zhujinxuan closed 4 years ago

zhujinxuan commented 5 years ago

Fix #157 Test is not added in this PR, can I know how to add test for it?

zhujinxuan commented 5 years ago

Hi, @nmattia Can I know how to pass args to ghci? It seems that the args passed to runExe does not work.

nmattia commented 5 years ago

Mh, right. There's some magic happening when running ghci: https://github.com/nmattia/snack/blob/a76301a911413a991a49a3254fe4c4385ad4954c/snack-lib/ghci.nix#L33

You'd probably want to call ghci (in ghci-with-files) with $@. The order of arguments may be a problem, you might need to reorder them.

zhujinxuan commented 5 years ago

Test with snack ghci -- -version, and it is working.

Almost ready, but snack ghci -p package.yaml -- --version cannot be parsed.

The parser error also exists for snack run https://github.com/nmattia/snack/issues/167. Let us fix it in another PR.

This PR is ready for review now.

nmattia commented 5 years ago

Looks great, thanks a lot!

nmattia commented 5 years ago

Test is not added in this PR, can I know how to add test for it?

We could add a test that only runs snack ghci (i.e. without snack build) to compile some code that would only compile with e.g. -XOverloadedStrings. Do you want to add that or should we merge as is?

nmattia commented 5 years ago

Actually you can probably copy this test, removing the extensions from the package.{yaml,nix}: https://github.com/nmattia/snack/tree/master/tests/extensions

zhujinxuan commented 4 years ago

Test added. Awaiting for the CI.

BTW, would you like to use 'Squash and Merge' to merge PR? Then I do not need to rebase to keep it one commit manually.

nmattia commented 4 years ago

@zhujinxuan thanks for the great work!

BTW, would you like to use 'Squash and Merge' to merge PR?

Sure thing!