haddock-library-1.4.3: Library exposing some functionality of Haddock.

Copyright | (c) Mateusz Kowalczyk 2013-2014, Simon Hengel 2013
License | BSD-like
Maintainer | haddock@projects.haskell.org
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Documentation.Haddock.Parser

Description

Parser used for Haddock comments. For external users of this library, the most commonly used combination of functions is going to be

    toRegular . parseParas

Synopsis

- parseString :: String -> DocH mod Identifier
- parseParas :: String -> MetaDoc mod Identifier
- overIdentifier :: (String -> Maybe a) -> DocH mod Identifier -> DocH mod a
- toRegular :: DocH mod Identifier -> DocH mod String
- type Identifier = (Char, String, Char)

# Documentation

parseString :: String -> DocH mod Identifier #

Parse a text paragraph. Actually just a wrapper over `parseStringBS` which drops leading whitespace and encodes the string to UTF8 first.

parseParas #

Arguments

:: String | String to parse
-> MetaDoc mod Identifier |

Main entry point to the parser. Appends the newline character to the input string.

overIdentifier :: (String -> Maybe a) -> DocH mod Identifier -> DocH mod a #

Maps over `DocIdentifier`s over `String` with potentially failing conversion using user-supplied function. If the conversion fails, the identifier is deemed to not be valid and is treated as a regular string.

toRegular :: DocH mod Identifier -> DocH mod String #

Drops the quotes/backticks around all identifiers, as if they were valid but still `String`s.

type Identifier = (Char, String, Char) #

Identifier string surrounded with opening and closing quotes/backticks.