Skip to content

Commit

Permalink
Merge pull request #179 from kindaro/master
Browse files Browse the repository at this point in the history
Add a note to readme concerning issue #167 (setup code cannot be within import statements).
  • Loading branch information
andreasabel authored Jan 24, 2018
2 parents 438ec5a + a97b756 commit 1079a47
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ Here is an example:

```haskell
module Foo where

import Bar.Baz

-- $setup
-- >>> let x = 23 :: Int

Expand All @@ -124,6 +127,12 @@ foo :: Int
foo = 42
```

Note that you should not place setup code inbetween the module header (`module
... where`) and import declarations. GHC will not be able to parse it ([issue
#167](https://github.com/sol/doctest/issues/167)). It is best to place setup
code right after import declarations, but due to its declarative nature you can
place it anywhere inbetween top level declarations as well.


### Multi-line input
GHCi supports commands which span multiple lines, and the same syntax works for doctest:
Expand Down

0 comments on commit 1079a47

Please sign in to comment.