Update docs for ‘charLiteral’ to mention ‘\&’

Close #154.
This commit is contained in:
mrkkrp 2016-11-24 20:08:54 +03:00
parent dd2386aafc
commit 86cca77cf5

View File

@ -361,6 +361,14 @@ lineFold sc action =
-- string literals:
--
-- > stringLiteral = char '"' >> manyTill L.charLiteral (char '"')
--
-- If you want to write @stringLiteral@ that adheres to the Haskell report
-- though, you'll need to take care of the @\\&@ combination which is not a
-- character, but can be used to separate characters (as in @\"\\291\\&4\"@
-- which is two characters long):
--
-- > stringLiteral = catMaybes <$> (char '"' >> manyTill ch (char '"'))
-- > where ch = (Just <$> L.charLiteral) <|> (Nothing <$ string "\\&")
charLiteral :: (MonadParsec e s m, Token s ~ Char) => m Char
charLiteral = label "literal character" $ do