Skip to content

Instantly share code, notes, and snippets.

@nkpart
Created January 13, 2015 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkpart/dadef2be40d27f58ec95 to your computer and use it in GitHub Desktop.
Save nkpart/dadef2be40d27f58ec95 to your computer and use it in GitHub Desktop.
A flycheck checker that runs the haskell variant of doctest
(flycheck-define-checker haskell-doctest
"Haskell doctest checker"
:command ("doctest" source)
:error-patterns
((error line-start "### Failure in " (file-name) ":" line ":" ;;line-end)
(message (one-or-more not-newline)
(one-or-more "\n"
(or (one-or-more " ")
"expected")
(one-or-more not-newline))
line-end)))
:modes haskell-mode)
(flycheck-add-next-checker 'haskell-hlint '(info . haskell-doctest))
(add-to-list 'flycheck-checkers 'haskell-doctest 'append)
;; Errors are expected to look something like this:
;; ### Failure in Wat.hs:43: expression `Nothing :: Maybe Int'
;; expected: Just 3
;; but got: Nothing
;; Examples: 12 Tried: 6 Errors: 0 Failures: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment