| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Shower.Class
Description
This module defines the representation of data that the parser produces and the pretty-printer consumes.
Synopsis
- class Shower a where
- showerRecord :: [ShowerComma (a, ShowerFieldSep, a)] -> a
- showerList :: [ShowerComma a] -> a
- showerTuple :: [ShowerComma a] -> a
- showerStringLit :: String -> a
- showerCharLit :: String -> a
- showerAtom :: String -> a
- showerSpace :: [a] -> a
- data ShowerFieldSep
- data ShowerComma a
Documentation
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.
Instances
| Shower ShowerDoc Source # | |
Defined in Shower.Printer Methods showerRecord :: [ShowerComma (ShowerDoc, ShowerFieldSep, ShowerDoc)] -> ShowerDoc Source # showerList :: [ShowerComma ShowerDoc] -> ShowerDoc Source # showerTuple :: [ShowerComma ShowerDoc] -> ShowerDoc Source # showerStringLit :: String -> ShowerDoc Source # showerCharLit :: String -> ShowerDoc Source # showerAtom :: String -> ShowerDoc Source # showerSpace :: [ShowerDoc] -> ShowerDoc Source # | |
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 |