doctest icon indicating copy to clipboard operation
doctest copied to clipboard

Inconsistent behavior on errors starting at GHC 8.0.1 due to callstacks

Open glguy opened this issue 9 years ago • 1 comments

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.

glguy avatar Jun 03 '16 17:06 glguy

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

soenkehahn avatar Jun 06 '16 03:06 soenkehahn