An abstract document data type with O(1) time concatenation (the current
implementation uses difference lists). Here s is the type of abstract
symbols or strings (text or binary). Doc s is a Monoid, therefore
mempty corresponds to the empty document and two documents can be
concatenated with mappend (or operator Data.Semigroup.<>). Documents
comprising a single symbol or string can be constructed using the function
literal. Alternatively, you can construct documents as string literals,
e.g. simply as "alga", by using the OverloadedStrings GHC extension. To
extract the document contents use the function render.
Note that the document comprising a single empty string is considered to be
different from the empty document. This design choice is motivated by the
desire to support string types s that have no Eq instance, such as
Data.ByteString.Builder, for which there is no way to check whether a
string is empty or not. As a consequence, the Eq and Ord instances are
defined as follows:
mempty /= literal ""
mempty < literal ""
Instances6Eq, Ord, Show, IsString, Semigroup, Monoid
(Monoid s, Eq s) => Eq (Doc s)Defined in algebraic-graphs-0.8 · Algebra.Graph.Export(Monoid s, Ord s) => Ord (Doc s)Defined in algebraic-graphs-0.8 · Algebra.Graph.ExportThe empty document is smallest.
(Monoid s, Show s) => Show (Doc s)Defined in algebraic-graphs-0.8 · Algebra.Graph.ExportIsString s => IsString (Doc s)Defined in algebraic-graphs-0.8 · Algebra.Graph.ExportSemigroup (Doc s)Defined in algebraic-graphs-0.8 · Algebra.Graph.ExportMonoid (Doc s)Defined in algebraic-graphs-0.8 · Algebra.Graph.Export