doctest
doctest copied to clipboard
Inconsistent behavior on errors starting at GHC 8.0.1 due to callstacks
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.
Note that you can maybe work around this issue with ...: https://github.com/sol/doctest#matching-arbitrary-output.