Comments (26)
In ghci 7.8 RC1, this works:
let f x y = reverse [x,y] == [y,x]
$(polyQuickCheck (mkName "f")) -- sent as a new statement
from doctest.
@aavogt Thanks. With many tries, I created the patch above.
@sol The keyword "in" does not work. So, patch is like this.
This patch works well both with GHC 7.6.3 and GHC 7.8.
With GHC 7.6.3, all tests are passed.
With GHC 7.8, the following test cases still fail:
1) Interpreter.eval gives an error message for identifiers that are not in scope
predicate failed on: "\n<interactive>:16:1: Not in scope: \8216foo\8217\n"
2) Main.doctest template-haskell
template-haskell ["Foo.hs"]
expected: Examples: 2 Tried: 2 Errors: 0 Failures: 0
but got: Examples: 2 Tried: 2 Errors: 0 Failures: 1
3) Main, doctest (regression tests), template-haskell-bugfix
template-haskell-bugfix ["Main.hs"]
expected: Examples: 2 Tried: 2 Errors: 0 Failures: 0
but got: Examples: 2 Tried: 2 Errors: 0 Failures: 1
from doctest.
- is trivial. Fixed.
from doctest.
The rest two are relating to:
https://ghc.haskell.org/trac/ghc/ticket/8831
What we can do is just waiting.
from doctest.
OK. The coming GHC 7.8 fixed this.
@sol Please release the next version.
from doctest.
@kazu-yamamoto I'm happy to release a new version, but do we still need 35879d5? If not, I'd prefer to remove it.
from doctest.
A good question! I reverted it and tried make test
. Unfortunately, 14 test cases of spec failed. So, I think it is necessary.
from doctest.
@kazu-yamamoto Ok, just release 0.9.11
to Hackage. Can you give it a quick try?
from doctest.
OK. doctest v0.9.11 works with GHC 7.8 for my purpose. Thanks.
from doctest.
Good news. Repo of GHC now has a tag "ghc-7.8.1-release". All tests of doctest head are passed with this GHC 7.8.1.
from doctest.
Cool :)
So we can close this?
from doctest.
Yes!
from doctest.
Interestingly I seem to have hit the same problem or a very similar one. See the Travis log at https://travis-ci.org/dmcclean/intervals/builds/24157318
I am using GHC 7.8.2 and doctest 0.9.11, but I still got:
interactive>:591:3:
Not in scope: ‘polyQuickCheck’
In the splice: $(polyQuickCheck (mkName "doctest_prop"))
<interactive>:591:3:
GHC stage restriction:
‘polyQuickCheck’ is used in a top-level splice or annotation,
and must be imported, not defined locally
In the expression: polyQuickCheck (mkName "doctest_prop")
In the splice: $(polyQuickCheck (mkName "doctest_prop"))
<interactive>:591:19:
Not in scope: ‘mkName’
In the splice: $(polyQuickCheck (mkName "doctest_prop"))
Examples: 203 Tried: 203 Errors: 0 Failures: 1
Test suite doctests: FAIL
from doctest.
So, which commit of "intervals" fixes the problem?
I cannot reproduce this.
from doctest.
None for me. The only way I know of to fix it is to delete the one -- prop>
comment.
from doctest.
An interesting thing is that the only change I made between build 22 and build 23 was switching from GHC 7.6.3 to 7.8.2 (on a hunch based on this thread that it might help). It didn't fix the problem, but it did change the error message.
Here's the one under 7.6.3:
<interactive>:329:3: Not in scope: `polyQuickCheck'
<interactive>:329:19: Not in scope: `mkName'
Examples: 203 Tried: 203 Errors: 0 Failures: 1
Test suite doctests: FAIL
from doctest.
I was able to reproduce it both on my local machine and on Travis's VM.
I also thought that maybe the implicit lambda in the property was the issue, so I changed it to -- prop> True
and then to -- prop> \x -> True
and got the same error messages.
from doctest.
This is an issue (or missing feature) with the custom Setup.lhs
(AFAICT).
from doctest.
@dmcclean you can fix this by adding "-packageQuickCheck"
and "-hide-all-packages"
to tests/doctests.hsc
(or alternatively add those dependencies to the corresponding test-suite
section in your cabal file).
from doctest.
Except then the version won't get fixed.
from doctest.
Yes, true, we could make doctest depend on QuickCheck
and template-haskell
(with the reasoning that doctest won't work properly without these packages). That would fixate the versions. Not sure if that is the right approach.
from doctest.
Thanks very much for the help guys.
The suggested workaround works fine for me.
from doctest.
I have resolved this issue on 7.8.3 by adding a dependency on template-haskell >= 2.8
in the test-suite
of the cabal file.
from doctest.
Is this something worth mentioning in the README?
from doctest.
@cheecheeo If you think this improves the situation than I'd happy to apply a patch.
from doctest.
Google led me here after encountering one of the error messages quoted above:
<interactive>:39:3:
Not in scope: ‘polyQuickCheck’
In the splice: $(polyQuickCheck (mkName "doctest_prop"))
<interactive>:39:3:
GHC stage restriction:
‘polyQuickCheck’ is used in a top-level splice or annotation,
and must be imported, not defined locally
In the expression: polyQuickCheck (mkName "doctest_prop")
In the splice: $(polyQuickCheck (mkName "doctest_prop"))
The solution (which wasn't immediately clear from this thread) was to perform a cabal install QuickCheck
before executing doctest.
from doctest.
Related Issues (20)
- Incompatible with markdown-unlit? HOT 1
- Doctest suite built with GHC 8.10.4 doesn't finish on Windows HOT 2
- "not in scope" errors when running with GHC 9 + stack test HOT 26
- doctest's doctests failing with GHC 8 & 9 HOT 14
- doctest's spec tests failing with GHC 9 HOT 4
- certain CPPs cause doctests to be ignored HOT 1
- Support GHC 9.2 HOT 2
- doctest extracts examples from code blocks
- New major version? HOT 1
- I could discuss if you wouldn't limit discussion. HOT 1
- Weird test failure due to type error with GHC 9.2.1 HOT 5
- "not in scope" errors when running with GHC 9 + stack test; redux HOT 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
- `doctest` in multi-GHC setting HOT 5
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.