sol / doctest

An implementation of Python's doctest for Haskell
http://hackage.haskell.org/package/doctest
MIT License
371 stars 72 forks source link

Add ability to start a cabal repl/GHCi session from a doctest #111

Open mantkiew opened 9 years ago

mantkiew commented 9 years ago

One of the complaints people have about REPL is that the context or setup is lost when you :reload. However, they are both preserved in doctests. It would be great to be able to open a REPL session from a doctest. It would support both the interactive development of doctests and REPL-style development (see Reddit discussion and the subsequent writeup Use the REPL, Luke.

That could be invoked using

doctest --command="cabal repl" Fib.hs

or

doctest --command=ghci Fib.hs

or even

doctest --command="stack ghci" Fib.hs

Similarly how you specify the command for ghcid.

sol commented 7 years ago

@mantkiew Sorry for the late reply. In case you are still interested in this, I would need more information. doctest clears the scope between example groups. So for the question is, at which point (or with what scope) would you want doctest to give you a GHCi session?

unhammer commented 6 years ago

Could you give it a line number for "first test after this line"? (Or, if it's easier, a top-level function name?) Then I could hit a key in Emacs and run a doctest immediately :-)