# Parse literate Haskell file

**URL:** <https://discourse.haskell.org/t/parse-literate-haskell-file/13839>\
**Category:** Learn\
**Created:** [March 23, 2026, 10:07pm UTC](https://discourse.haskell.org/t/parse-literate-haskell-file/13839 "2026-03-23T22:07:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcosh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/marcosh/32/436_2.png) [@marcosh](https://discourse.haskell.org/u/marcosh)\
**Post date:** [March 23, 2026, 10:07pm UTC](https://discourse.haskell.org/t/parse-literate-haskell-file/13839/1 "2026-03-23T22:07:19Z")

</div>

tldr: is it possible to parse a literate Haskell file with [`parseModuleEpAnnsWithCppInternal`](https://hackage-content.haskell.org/package/ghc-exactprint-1.14.0.0/docs/Language-Haskell-GHC-ExactPrint-Parsers.html#v:parseModuleEpAnnsWithCppInternal)?

longer question: I’m trying to contribute to [`doctest-parallel`](https://github.com/martijnbastiaan/doctest-parallel) so that it is able to handle literate Haskell files.

Currently I get to [a point](https://github.com/martijnbastiaan/doctest-parallel/blob/main/src/Test/DocTest/Internal/Extract.hs#L190) where `parseModuleEpAnnsWithCppInternal` is called and fails with the following error message

```haskell
parse error on input `>'

```

indicating that it is not able to parse a literate Haskell file. Is there a way to parse a literate Haskell file this way? Maybe setting something in the `CppOptions` or in the `DynFlags` arguments?

---

<div class="post-metadata">

**Author:** ![taylorfausak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/taylorfausak/32/54_2.png) [@taylorfausak](https://discourse.haskell.org/u/taylorfausak)\
**Post date:** [March 24, 2026, 12:22am UTC](https://discourse.haskell.org/t/parse-literate-haskell-file/13839/2 "2026-03-24T00:22:08Z")

</div>

Literate Haskell is handled by `unlit` before the parser. You can see how Scrod does it here: [scrod/source/library/Scrod/Executable/Main.hs at main · tfausak/scrod · GitHub](https://github.com/tfausak/scrod/blob/main/source/library/Scrod/Executable/Main.hs) (line 64).
