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

Inconsistent behavior on errors starting at GHC 8.0.1 due to callstacks #136

Open
glguy opened this issue Jun 3, 2016 · 1 comment
Open

Comments

@glguy
Copy link

glguy commented Jun 3, 2016

Now that GHC 8 has callstack printing for uses of error it seems tricky to write doctests that work across multiple versions of GHC.

Example:

### Failure in src/Control/Lens/Traversal.hs:639: expression `[] ^. singular _head'
expected: *** Exception: singular: empty traversal
 but got: *** Exception: singular: empty traversal
          CallStack (from HasCallStack):
            error, called at src/Control/Lens/Traversal.hs:663:46 in main:Control.Lens.Traversal

It might be worth omitting call stack printing somehow for the purposes of writing doctests. This would keep the examples concise and allow them to work more portably.

@soenkehahn
Copy link
Collaborator

Note that you can maybe work around this issue with ...: https://github.com/sol/doctest#matching-arbitrary-output.

TikhonJelvis added a commit to TikhonJelvis/doctest that referenced this issue Aug 16, 2020
I found dealing with callstacks in error messages pretty confusing when I first started using doctests. I didn't see anything in the README, but later on I saw the suggestion @soenkehahn  made on sol#136 and it seems to work perfectly.

Hopefully adding this to the README will help other people in the same boat find the solution faster :).
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