shower-0.2.0.3: Clean up the formatting of 'show' output
Safe HaskellSafe-Inferred
LanguageHaskell2010

Shower.Class

Description

This module defines the representation of data that the parser produces and the pretty-printer consumes.

Synopsis

Documentation

class Shower a where Source #

A tagless final encoding for a result builder (ShowS, Doc, Html, etc).

Note that showerStringLit and showerCharLit take exact uninterpreted strings to avoid losing information (e.g. "\n" vs. "\10").

Methods

showerRecord :: [ShowerComma (a, ShowerFieldSep, a)] -> a Source #

A record, { x = 24, y = 42 } or { "a": null, "b": 13 }.

showerList :: [ShowerComma a] -> a Source #

A list, [1, 2, 3].

showerTuple :: [ShowerComma a] -> a Source #

A tuple, (1, 2, 3).

showerStringLit :: String -> a Source #

A string literal, "hello, (world)".

showerCharLit :: String -> a Source #

A character literal, '('.

showerAtom :: String -> a Source #

Variable names, numeric literals, and so on.

showerSpace :: [a] -> a Source #

Whitespace-separated elements.

data ShowerFieldSep Source #

A field separator used in records, either '=' for Haskell records or ':' for JSON.

Constructors

ShowerFieldSepEquals

An equality sign, '='

ShowerFieldSepColon

A colon, ':'

data ShowerComma a Source #

Either a comma or an element.

For example, the tuple section (,a,,b) is represented like this:

[ ShowerCommaSep,
  ShowerCommaElement "a",
  ShowerCommaSep,
  ShowerCommaSep,
  ShowerCommaElement "b" ]

Constructors

ShowerCommaSep

A comma, ','

ShowerCommaElement a

An element