type-level-show-0.1.1: Utilities for writing Show-like type families
Safe HaskellSafe-Inferred
LanguageGHC2021

TypeLevelShow.Doc

Synopsis

Documentation

data Doc s Source #

Simple pretty document ADT.

Designed to work on both type level (as a limited ErrorMessage) and term level (as a boring ADT).

Note that ShowType is magical (see compilerGHCCore/Type.hs#L1309), so we need to remove it for term level.

singletons-base defines a version of this, but retains the ShowType constructor and is in the singletons ecosystem.

Constructors

Text s

plain ol' text

(Doc s) :<>: (Doc s)

append docs next to each other

(Doc s) :$$: (Doc s)

stack docs on top of each other (newline)

Instances

Instances details
Show s => Show (Doc s) Source # 
Instance details

Defined in TypeLevelShow.Doc

Methods

showsPrec :: Int -> Doc s -> ShowS #

show :: Doc s -> String #

showList :: [Doc s] -> ShowS #

type PDoc = Doc Symbol Source #

Promoted Doc.

type family RenderDoc doc where ... Source #

Render a PDoc as an ErrorMessage, for type-level error messages.

PDoc is a subset of ErrorMessage, so this is very boring.

class ReifyDoc (doc :: PDoc) where Source #

Reify a promoted Doc to the corresponding term-level one.

Instances

Instances details
KnownSymbol s => ReifyDoc ('Text s) Source # 
Instance details

Defined in TypeLevelShow.Doc

(ReifyDoc l, ReifyDoc r) => ReifyDoc (l ':$$: r) Source # 
Instance details

Defined in TypeLevelShow.Doc

(ReifyDoc l, ReifyDoc r) => ReifyDoc (l ':<>: r) Source # 
Instance details

Defined in TypeLevelShow.Doc