hscolour-1.25: Colourise Haskell code.

Safe Haskell | None
Language | Haskell98

Language.Haskell.HsColour

Description

This is a library which colourises Haskell code. It currently has six output formats:

- ANSI terminal codes
- LaTeX macros
- HTML 3.2 with font tags
- HTML 4.01 with external CSS.
- XHTML 1.0 with internal CSS.
- mIRC chat client colour codes.

Synopsis

- data Output
  - = TTY
  - | TTYg TerminalType
  - | LaTeX
  - | HTML
  - | CSS
  - | ACSS
  - | ICSS
  - | MIRC
- data ColourPrefs = ColourPrefs {
  - keyword :: [Highlight]
  - keyglyph :: [Highlight]
  - layout :: [Highlight]
  - comment :: [Highlight]
  - conid :: [Highlight]
  - varid :: [Highlight]
  - conop :: [Highlight]
  - varop :: [Highlight]
  - string :: [Highlight]
  - char :: [Highlight]
  - number :: [Highlight]
  - cpp :: [Highlight]
  - selection :: [Highlight]
  - variantselection :: [Highlight]
  - definition :: [Highlight]
  }
- hscolour :: Output -> ColourPrefs -> Bool -> Bool -> String -> Bool -> String -> String

# Documentation

data Output Source #

The supported output formats.

Constructors

TTY | ANSI terminal codes. Equivalent to `TTYg` `Ansi16Colour` but left in for backwards compatibility.
TTYg TerminalType | Terminal codes appropriate for the `TerminalType`.
LaTeX | TeX macros
HTML | HTML with font tags
CSS | HTML with CSS.
ACSS | HTML with CSS and mouseover types.
ICSS | HTML with inline CSS.
MIRC | mIRC chat clients

#### Instances

Instances details

Show Output Source # |
Instance details Defined in Language.Haskell.HsColour.Output Methods showsPrec :: Int -> Output -> ShowS Source # show :: Output -> String Source # showList :: [Output] -> ShowS Source #
Eq Output Source # |
Instance details Defined in Language.Haskell.HsColour.Output Methods (==) :: Output -> Output -> Bool Source # (/=) :: Output -> Output -> Bool Source #

data ColourPrefs Source #

Colour preferences.

Constructors

ColourPrefs |

Fields

- keyword :: [Highlight]
- keyglyph :: [Highlight]
- layout :: [Highlight]
- comment :: [Highlight]
- conid :: [Highlight]
- varid :: [Highlight]
- conop :: [Highlight]
- varop :: [Highlight]
- string :: [Highlight]
- char :: [Highlight]
- number :: [Highlight]
- cpp :: [Highlight]
- selection :: [Highlight]
- variantselection :: [Highlight]
- definition :: [Highlight]

#### Instances

Instances details

Read ColourPrefs Source # |
Instance details Defined in Language.Haskell.HsColour.Colourise Methods readsPrec :: Int -> ReadS ColourPrefs Source # readList :: ReadS [ColourPrefs] Source # readPrec :: ReadPrec ColourPrefs Source # readListPrec :: ReadPrec [ColourPrefs] Source #
Show ColourPrefs Source # |
Instance details Defined in Language.Haskell.HsColour.Colourise Methods showsPrec :: Int -> ColourPrefs -> ShowS Source # show :: ColourPrefs -> String Source # showList :: [ColourPrefs] -> ShowS Source #
Eq ColourPrefs Source # |
Instance details Defined in Language.Haskell.HsColour.Colourise Methods (==) :: ColourPrefs -> ColourPrefs -> Bool Source # (/=) :: ColourPrefs -> ColourPrefs -> Bool Source #

hscolour Source #

Arguments

:: Output | Output format.
-> ColourPrefs | Colour preferences (for formats that support them).
-> Bool | Whether to include anchors.
-> Bool | Whether output document is partial or complete.
-> String | Title for output.
-> Bool | Whether input document is literate haskell or not
-> String | Haskell source code.
-> String | Coloured Haskell source code.

Colourise Haskell source code with the given output format.