Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for new-style cabal builds #317

Closed
dtchepak opened this issue Feb 1, 2019 · 3 comments
Closed

Instructions for new-style cabal builds #317

dtchepak opened this issue Feb 1, 2019 · 3 comments

Comments

@dtchepak
Copy link
Contributor

dtchepak commented Feb 1, 2019

Running the commands from the readme for building:

> cabal install --only-dependencies --enable-tests && cabal configure --enable-tests && cabal build

Gives the following warning on cabal-install 2.4.1, GHC 8.6.3:

Warning: The install command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.

Switching these commands to use new-* instead gives the following error:

> cabal new-install --only-dependencies --enable-tests
cabal: --enable-tests was specified, but tests can't be enabled in a remote
package

Might be worth adding alternative instructions to the readme to support new-style cabal projects?

@gwils
Copy link
Collaborator

gwils commented Feb 1, 2019

Thanks for the report. Indeed, the latest few cabal versions give that warning.

I'm hesitant to update the instructions because the --test-options flag does not yet work in new-test in the most recently released version of cabal (2.4.1.0 at the time of writing, see haskell/cabal#4766 and haskell/cabal#5455)

Without using --test-options to limit which tests are run, the tests are cumbersome to work with due to how many there are (the results you want to look at scroll right off the screen!). When new-test supports this flag in a widely-installed version of cabal, I'll update the instructions. I'll leave this issue open until then.

For now, I'd recommend sticking with the instructions as written (using old-style cabal). If you want to proceed with new-build anyway despite how much test output will overwhelm your screen, you could do so as follows:

cabal new-update
cabal new-configure --enable-tests
cabal new-build
cabal new-test

Another alternative worth mentioning is to avoid cabal altogether and simply use ghci. You can copy and paste the "tests" in the comments above each exercise into your ghci session to verify your solutions.

@dtchepak
Copy link
Contributor Author

In case it helps anyone else that finds this issue, we can filter tests for new-style cabal by running the tasty build output directly (as per haskell/cabal#4766 (comment)):

cabal new-run tasty -- --pattern "Tests.List."

-- Or just
cabal new-run tasty -- -p "Tests.List."

@gwils
Copy link
Collaborator

gwils commented Nov 29, 2019

The course no longer uses cabal or any build tool, and you can find test instructions in the README.

@gwils gwils closed this as completed Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants