Comments (6)
doctest
however gets confused in such settings. E.g. I installeddoctest
for 9.2.5:$ cabal install -w ghc-9.2.5 doctest --program-suffix=-9.2.5 ... $ doctest-9.2.5 --version doctest version 0.20.1 using version 9.2.5 of the GHC API using /usr/local/bin/ghc-9.2.5 $ doctest-9.2.5 --numeric-version 9.2.5
As one can see,
doctest
is well aware of the GHC version it is build for. However:$ cabal repl -w doctest-9.2.5 Error: cabal: Version mismatch between ghc and ghc-pkg: doctest-9.2.5 is version 9.2.5 /usr/local/bin/ghc-pkg is version 9.4.4
From what I understand, cabal
gets confused here, not doctest
.
I can't shake the feeling that this
cabal repl -w doctest
is just a hack that in some benign cases works but in general fails.
I'm not aware of any better (or even remotely robust) way to get the correct flags for a Cabal project.
AFAIK, e.g. hie-bios
/ hls
use the same approach to get the correct flags for a source file + other tools could benefit from it too. If there are limitations with cabal
then I think addressing these limitations in cabal
is the way forward.
Frankly, I don't know how
cabal
determinesghc-pkg-x.y.z
fromghc-x.y.z
That's the relevant question.
Educated guess:
cabal
looks at the canonical path ofghc
(all symlinks resolved) and then uses anyghc-pkg
next to that.- If there is no such
ghc-pkg
(as would be the case withdoctest
) thencabal
falls back to whateverghc-pkg
is on thePATH
.
(just an educated guess, somebody would need to confirm this by looking at the code)
A more robust way for cabal
to find ghc-pkg
would be to look at the output of ghc --info
. ghc --info
does not contain the path to ghc-pkg
. However, it contain the path to unlit
and ghc-pkg
is in that same directory.
from doctest.
@andreasabel please try if --with-hc-pkg=ghc-pkg-9.2.5
can be used as a workaround.
from doctest.
@andreasabel haskell/cabal#8718 addresses this in Cabal
; no changes to doctest
required.
from doctest.
I revived @sol's PR at haskell/cabal#10057.
@sol does hie-bios
/hls
uses the same ghc
key in their augmented ghc --info
? Because I wonder if an alternative ghc:path
or path:ghc
would allow more flexibility if adapted to other tools/values.
from doctest.
I revived @sol's PR at haskell/cabal#10057.
Great 👍
@sol does
hie-bios
/hls
uses the sameghc
key in their augmentedghc --info
?
I'm not aware that they would do anything in that regard right now.
from doctest.
This is addressed by #439.
With cabal-install
version 3.12 or later try:
$ cabal install --ignore-project doctest --flag cabal-doctest
$ cabal doctest -w ghc-8.6.5
Examples: 2 Tried: 2 Errors: 0 Failures: 0
from doctest.
Related Issues (20)
- Disable test without changing rendering HOT 1
- 0.20.0 doesn't build on ghc 9.4.2 HOT 6
- Invalid platform constants HOT 2
- Error related to OverloadedLists not reported as such HOT 3
- Extra `type-defaults` warnings (from `OverloadedStrings`) make doctests fail HOT 10
- Build failure on GHC 9.6 HOT 1
- How to pass `--fast` when going via `cabal repl`? HOT 1
- One test fails with GHC 9.6.1 HOT 1
- Ci: ubuntu-18.04 will be discontinued soon HOT 1
- Can I focus doctest on a particular function in a module or can I exclude functions from being tested? HOT 2
- GHC 9.4.5, doctest 0.22.0 `$setup import …` does only work with `cabal repl --with-ghc=doctest` HOT 1
- `cabal test` integration (GHC 9.4.5) HOT 7
- cabal repl --enable-multi-repl --with-ghc=doctest fails with "unrecognized option `-unit'" HOT 4
- Unexpected Kind errors when building tests
- Build failure with GHC 9.6 HOT 1
- Could we have multiline expectations? HOT 1
- Support GHC 9.10 HOT 3
- Add `cabal-doctest` HOT 3
- Error index links should be hidden
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctest.