-
Notifications
You must be signed in to change notification settings - Fork 73
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
Extra type-defaults
warnings (from OverloadedStrings
) make doctests fail
#390
Comments
Actually, I cannot confirm that It must be other effects that fix this sporadic problem. Like running for a second time, building again, whatever. I cannot see the pattern. |
A reliable workaround is to add this to the
|
@andreasabel I think we want to make sure that Can you check if If no, we want to figure out how to convince If yes, we want to understand what's going on Doctest's side, likely in |
To try to simulate this in GHCI/cabal repl I'd need to know what |
I tried to construct a little reproducer:
cabal-version: 2.0
name: doctest-issue
version: 0.0.0
build-type: Simple
library
hs-source-dirs: src
exposed-modules: OverloadedStrings
default-language: Haskell2010
default-extensions: OverloadedStrings
ghc-options: -Wall
build-depends: base
module OverloadedStrings (foo) where
-- | Fooking do noothing.
--
-- >>> foo ["a", "b", "c"]
-- ["a","b","c"]
--
foo :: Ord a => [a] -> [a]
foo xs = xs However, in this case the $ cabal build && cabal repl -w doctest --ghc-options=-Wno-type-defaults
... (ok) I shrank too much, it seems. |
I have played 2 hours now with this issue and I found that
All this depends on the history of (at least) the following actions. Research question:
|
This sounds frightening. If you can come up with a repro then I guess we need a Cabal issue for this (a repro without |
Here is an example run, organized in three lines:
This random sequence supports the following thesis:
|
Wer lesen kann, ist im Vorteil. RTFD:
Ok, this explains the erratic behavior. (What I do not understand, though, is why @sol wrote:
So, answer is, it does not work, but (This it the first time I see |
Reported |
I have been using
cabal-doctest
to build a doctest testsuite (which is then run viacabal test
). However,cabal-doctest
requires custom setup in the.cabal
file with aCabal
dependency, which is bad for the dependency footprint.So I am trying the "new" recipe (not soo new anymore):
This fails some doctests (that should pass) because I get mysterious
type-defaults
warnings (see below).I can workaround this via
(UPDATE: the OP used
--ghc-options
which does not work reliably, see discussion to follow.)Couldn't this problem fixed generally by not counting GHCI warnings as part of the test result?
Example:
We can see here that this implementation of doctests does not deal properly with
{-# LANGUAGE OverloadedStrings #-}
.The text was updated successfully, but these errors were encountered: