aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2019-05-02 23:39:41 +0300
committerAlec Theriault <alec.theriault@gmail.com>2019-05-05 13:02:00 -0700
commit96d094403e343ecf28c1898c9792e4bb1699b58a (patch)
treec7fdd410d9fe438c30749091ffcd295208e90fc5 /haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
parent622ea3f4088039d7c1cca84f11954fc82288a3c6 (diff)
Comment C, which clarifies why e.g. ReadP is not enough
Diffstat (limited to 'haddock-api/src/Haddock/Interface/ParseModuleHeader.hs')
-rw-r--r--haddock-api/src/Haddock/Interface/ParseModuleHeader.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
index e4528522..6ac2f186 100644
--- a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
+++ b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
@@ -86,6 +86,13 @@ parseModuleHeader dflags pkgName str0 =
-- the value will be "this is a .. description" and the rest will begin
-- at "The module comment".
+-- | 'C' is a 'Char' carrying its column.
+--
+-- This let us make an indentation-aware parser, as we know current indentation.
+-- by looking at the next character in the stream ('curInd').
+--
+-- Thus we can munch all spaces but only not-spaces which are indented.
+--
data C = C {-# UNPACK #-} !Int Char
newtype P a = P { unP :: [C] -> Maybe ([C], a) }