haddock-library-1.11.0: 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 | Safe-Inferred
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 . _doc . parseParas

Synopsis

- parseString :: String -> DocH mod Identifier
- parseParas :: Maybe Package -> String -> MetaDoc mod Identifier
- overIdentifier :: (Namespace -> String -> Maybe a) -> DocH mod Identifier -> DocH mod a
- toRegular :: DocH mod Identifier -> DocH mod String
- data Identifier

# Documentation

parseString :: String -> DocH mod Identifier Source #

Variant of `parseText` for `String` instead of `Text`

parseParas Source #

Arguments

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

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

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

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 Source #

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

data Identifier Source #

Identifier string surrounded with namespace, opening, and closing quotes/backticks.

#### Instances

Instances details

Show Identifier Source # |
Instance details Defined in Documentation.Haddock.Parser.Identifier Methods showsPrec :: Int -> Identifier -> ShowS Source # show :: Identifier -> String Source # showList :: [Identifier] -> ShowS Source #
Eq Identifier Source # |
Instance details Defined in Documentation.Haddock.Parser.Identifier Methods (==) :: Identifier -> Identifier -> Bool Source # (/=) :: Identifier -> Identifier -> Bool Source #