    -- | Highlights Haskell code with ANSI terminal codes.
    module Language.Haskell.HsColour.TTY (hscolour,hscolourG) where

    import Language.Haskell.HsColour.ANSI as ANSI
    import Language.Haskell.HsColour.Classify
    import Language.Haskell.HsColour.Colourise
    import Language.Haskell.HsColour.Output(TerminalType(Ansi16Colour))

    -- | = 'hscolourG' 'Ansi16Colour'
    hscolour :: ColourPrefs -- ^ Colour preferences.
             -> String      -- ^ Haskell source code.
             -> String      -- ^ Coloured Haskell source code.
    hscolour :: ColourPrefs -> String -> String
    hscolour = TerminalType -> ColourPrefs -> String -> String
    hscolourG TerminalType
    Ansi16Colour

    -- | Highlights Haskell code with ANSI terminal codes.
    hscolourG :: TerminalType -> ColourPrefs -> String -> String
    hscolourG TerminalType
    terminalType ColourPrefs
    pref = ((TokenType, String) -> String) -> [(TokenType, String)] -> String
    forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
    concatMap (TerminalType -> ColourPrefs -> (TokenType, String) -> String
    renderTokenG TerminalType
    terminalType ColourPrefs
    pref) ([(TokenType, String)] -> String)
    -> (String -> [(TokenType, String)]) -> String -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> [(TokenType, String)]
    tokenise

    renderToken :: ColourPrefs -> (TokenType,String) -> String
    renderToken :: ColourPrefs -> (TokenType, String) -> String
    renderToken = TerminalType -> ColourPrefs -> (TokenType, String) -> String
    renderTokenG TerminalType
    Ansi16Colour

    renderTokenG :: TerminalType -> ColourPrefs -> (TokenType, String) -> String
    renderTokenG TerminalType
    terminalType ColourPrefs
    pref (TokenType
    t,String
    s) = TerminalType -> [Highlight] -> String -> String
    ANSI.highlightG TerminalType
    terminalType (ColourPrefs -> TokenType -> [Highlight]
    colourise ColourPrefs
    pref TokenType
    t) String
    s