symantic-document-1.5.3.20200320: Symantics combinators for generating documents.
Safe HaskellNone
LanguageHaskell2010

Symantic.Document.Lang

Synopsis

Helper types

type SGR = SGR Source #

Type Line

newtype Line d Source #

Constructors

Line d 

Instances

Instances details
Eq d => Eq (Line d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

(==) :: Line d -> Line d -> Bool #

(/=) :: Line d -> Line d -> Bool #

Show d => Show (Line d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

showsPrec :: Int -> Line d -> ShowS #

show :: Line d -> String #

showList :: [Line d] -> ShowS #

Lengthable d => Lengthable (Line d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

width :: Line d -> Column Source #

nullWidth :: Line d -> Bool Source #

From d Builder => From (Line d) Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> Builder Source #

From d Text => From (Line d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> Text Source #

From d Text => From (Line d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> Text Source #

From d String => From (Line d) String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> String Source #

(From (Word s) d, Lengthable s, Spaceable d, Splitable s) => From (Line s) (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Line s -> Plain d Source #

unLine :: Line d -> d Source #

Type Word

newtype Word d Source #

Constructors

Word d 

Instances

Instances details
Eq d => Eq (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

(==) :: Word d -> Word d -> Bool #

(/=) :: Word d -> Word d -> Bool #

Show d => Show (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

showsPrec :: Int -> Word d -> ShowS #

show :: Word d -> String #

showList :: [Word d] -> ShowS #

Semigroup d => Semigroup (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

(<>) :: Word d -> Word d -> Word d #

sconcat :: NonEmpty (Word d) -> Word d #

stimes :: Integral b => b -> Word d -> Word d #

Lengthable d => Lengthable (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

width :: Word d -> Column Source #

nullWidth :: Word d -> Bool Source #

From d Builder => From (Word d) Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> Builder Source #

From d Text => From (Word d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> Text Source #

From d Text => From (Word d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> Text Source #

From d String => From (Word d) String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> String Source #

From [SGR] d => From [SGR] (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: [SGR] -> Word d Source #

(From (Word s) d, Semigroup d, Lengthable s) => From (Word s) (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Word s -> Plain d Source #

unWord :: Word d -> d Source #

Class From

class From a d where Source #

Minimal complete definition

Nothing

Methods

from :: a -> d Source #

default from :: From String d => Show a => a -> d Source #

Instances

Instances details
From Char String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Char -> String Source #

From Char Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Char -> Builder Source #

From Char Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Char -> Text Source #

From Char Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Char -> Text Source #

From (Line String) d => From Int d Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Int -> d Source #

From (Line String) d => From Integer d Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Integer -> d Source #

From (Line String) d => From Natural d Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Natural -> d Source #

From String String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: String -> String Source #

From String Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: String -> Builder Source #

From String Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: String -> Text Source #

From String Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: String -> Text Source #

From Builder Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Builder -> Builder Source #

From Text String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> String Source #

From Text Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> Builder Source #

From Text Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> Text Source #

From Text Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text0 -> Text Source #

From Text String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> String Source #

From Text Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> Builder Source #

From Text Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> Text0 Source #

From Text Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Text -> Text Source #

(From (Word Char) d, Spaceable d) => From Char (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Char -> Plain d Source #

(From (Word String) d, Spaceable d) => From String (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: String -> Plain d Source #

(From (Word Text) d, Spaceable d) => From Text (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Text -> Plain d Source #

(From (Word Text) d, Spaceable d) => From Text (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Text -> Plain d Source #

From [SGR] String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: [SGR] -> String Source #

From [SGR] Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: [SGR] -> Builder Source #

From [SGR] Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: [SGR] -> Text Source #

From [SGR] Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: [SGR] -> Text Source #

From d Builder => From (Word d) Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> Builder Source #

From d Text => From (Word d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> Text Source #

From d Text => From (Word d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> Text Source #

From d String => From (Word d) String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Word d -> String Source #

From d Builder => From (Line d) Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> Builder Source #

From d Text => From (Line d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> Text Source #

From d Text => From (Line d) Text Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> Text Source #

From d String => From (Line d) String Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: Line d -> String Source #

From [SGR] d => From [SGR] (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

from :: [SGR] -> Word d Source #

From [SGR] d => From [SGR] (PlainChunk d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: [SGR] -> PlainChunk d Source #

(From [SGR] d, Semigroup d) => From [SGR] (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: [SGR] -> Plain d Source #

(From (Word s) d, Semigroup d, Lengthable s) => From (Word s) (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Word s -> Plain d Source #

(From (Word s) d, Lengthable s, Spaceable d, Splitable s) => From (Line s) (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

from :: Line s -> Plain d Source #

Class Lengthable

class Lengthable d where Source #

Minimal complete definition

width

Methods

width :: d -> Column Source #

nullWidth :: d -> Bool Source #

Instances

Instances details
Lengthable Char Source # 
Instance details

Defined in Symantic.Document.Lang

Lengthable String Source # 
Instance details

Defined in Symantic.Document.Lang

Lengthable Text Source # 
Instance details

Defined in Symantic.Document.Lang

Lengthable Text Source # 
Instance details

Defined in Symantic.Document.Lang

Lengthable d => Lengthable (Word d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

width :: Word d -> Column Source #

nullWidth :: Word d -> Bool Source #

Lengthable d => Lengthable (Line d) Source # 
Instance details

Defined in Symantic.Document.Lang

Methods

width :: Line d -> Column Source #

nullWidth :: Line d -> Bool Source #

Lengthable d => Lengthable (PlainChunk d) Source # 
Instance details

Defined in Symantic.Document.Plain

Class Spaceable

class Monoid d => Spaceable d where Source #

Minimal complete definition

Nothing

Methods

newline :: d Source #

default newline :: Spaceable (UnTrans d) => Trans d => d Source #

space :: d Source #

default space :: Spaceable (UnTrans d) => Trans d => d Source #

spaces :: Column -> d Source #

default spaces :: Monoid d => Column -> d Source #

unlines :: Foldable f => f (Line d) -> d Source #

unwords :: Foldable f => Functor f => f (Word d) -> d Source #

catLines :: Foldable f => Functor f => f (Line d) -> d Source #

Like unlines but without the trailing newline.

(<+>) :: d -> d -> d infixr 6 Source #

x <+> y = x <> space <> y

(</>) :: d -> d -> d infixr 6 Source #

x </> y = x <> newline <> y

catH :: Foldable f => f d -> d Source #

catV :: Foldable f => f d -> d Source #

Instances

Instances details
Spaceable String Source # 
Instance details

Defined in Symantic.Document.Lang

Spaceable Builder Source # 
Instance details

Defined in Symantic.Document.Lang

Spaceable Text Source # 
Instance details

Defined in Symantic.Document.Lang

Spaceable Text Source # 
Instance details

Defined in Symantic.Document.Lang

Spaceable d => Spaceable (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

newline :: Plain d Source #

space :: Plain d Source #

spaces :: Column -> Plain d Source #

unlines :: Foldable f => f (Line (Plain d)) -> Plain d Source #

unwords :: (Foldable f, Functor f) => f (Word (Plain d)) -> Plain d Source #

catLines :: (Foldable f, Functor f) => f (Line (Plain d)) -> Plain d Source #

(<+>) :: Plain d -> Plain d -> Plain d Source #

(</>) :: Plain d -> Plain d -> Plain d Source #

catH :: Foldable f => f (Plain d) -> Plain d Source #

catV :: Foldable f => f (Plain d) -> Plain d Source #

intercalate :: (Foldable f, Monoid d) => d -> f d -> d Source #

replicate :: Monoid d => Int -> d -> d Source #

between :: Semigroup d => d -> d -> d -> d Source #

parens :: Semigroup d => From (Word Char) d => d -> d Source #

braces :: Semigroup d => From (Word Char) d => d -> d Source #

brackets :: Semigroup d => From (Word Char) d => d -> d Source #

angles :: Semigroup d => From (Word Char) d => d -> d Source #

Class Splitable

class (Lengthable d, Monoid d) => Splitable d where Source #

Minimal complete definition

tail, break

Methods

tail :: d -> Maybe d Source #

break :: (Char -> Bool) -> d -> (d, d) Source #

span :: (Char -> Bool) -> d -> (d, d) Source #

lines :: d -> [Line d] Source #

words :: d -> [Word d] Source #

linesNoEmpty :: d -> [Line d] Source #

wordsNoEmpty :: d -> [Word d] Source #

splitOnChar :: (Char -> Bool) -> d -> [d] Source #

splitOnCharNoEmpty :: (Char -> Bool) -> d -> [d] Source #

Instances

Instances details
Splitable String Source # 
Instance details

Defined in Symantic.Document.Lang

Splitable Text Source # 
Instance details

Defined in Symantic.Document.Lang

Splitable Text Source # 
Instance details

Defined in Symantic.Document.Lang

Class Decorable

class Decorable d where Source #

Minimal complete definition

Nothing

Methods

bold :: d -> d Source #

default bold :: Decorable (UnTrans d) => Trans d => d -> d Source #

underline :: d -> d Source #

default underline :: Decorable (UnTrans d) => Trans d => d -> d Source #

italic :: d -> d Source #

default italic :: Decorable (UnTrans d) => Trans d => d -> d Source #

Instances

Instances details
(Semigroup d, From [SGR] d) => Decorable (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

bold :: Plain d -> Plain d Source #

underline :: Plain d -> Plain d Source #

italic :: Plain d -> Plain d Source #

Class Colorable16

class Colorable16 d where Source #

Minimal complete definition

Nothing

Methods

reverse :: d -> d Source #

default reverse :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

black :: d -> d Source #

default black :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

red :: d -> d Source #

default red :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

green :: d -> d Source #

default green :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

yellow :: d -> d Source #

default yellow :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

blue :: d -> d Source #

default blue :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

magenta :: d -> d Source #

default magenta :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

cyan :: d -> d Source #

default cyan :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

white :: d -> d Source #

default white :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

blacker :: d -> d Source #

default blacker :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

redder :: d -> d Source #

default redder :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

greener :: d -> d Source #

default greener :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

yellower :: d -> d Source #

default yellower :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

bluer :: d -> d Source #

default bluer :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

magentaer :: d -> d Source #

default magentaer :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

cyaner :: d -> d Source #

default cyaner :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

whiter :: d -> d Source #

default whiter :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onBlack :: d -> d Source #

default onBlack :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onRed :: d -> d Source #

default onRed :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onGreen :: d -> d Source #

default onGreen :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onYellow :: d -> d Source #

default onYellow :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onBlue :: d -> d Source #

default onBlue :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onMagenta :: d -> d Source #

default onMagenta :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onCyan :: d -> d Source #

default onCyan :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onWhite :: d -> d Source #

default onWhite :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onBlacker :: d -> d Source #

default onBlacker :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onRedder :: d -> d Source #

default onRedder :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onGreener :: d -> d Source #

default onGreener :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onYellower :: d -> d Source #

default onYellower :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onBluer :: d -> d Source #

default onBluer :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onMagentaer :: d -> d Source #

default onMagentaer :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onCyaner :: d -> d Source #

default onCyaner :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

onWhiter :: d -> d Source #

default onWhiter :: Colorable16 (UnTrans d) => Trans d => d -> d Source #

Instances

Instances details
Colorable16 String Source #

For debugging purposes.

Instance details

Defined in Symantic.Document.Lang

(Semigroup d, From [SGR] d) => Colorable16 (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

xmlSGR :: Semigroup d => From String d => String -> d -> d Source #

For debugging purposes.

Class Indentable

class Spaceable d => Indentable d where Source #

Minimal complete definition

Nothing

Methods

align :: d -> d Source #

(align d) make d uses current Column as Indent level.

default align :: Indentable (UnTrans d) => Trans d => d -> d Source #

setIndent :: d -> Indent -> d -> d Source #

(setIndent p ind d) make d uses ind as Indent level. Using p as Indent text.

default setIndent :: Indentable (UnTrans d) => Trans d => d -> Indent -> d -> d Source #

incrIndent :: d -> Indent -> d -> d Source #

(incrIndent p ind d) make d uses current Indent plus ind as Indent level. Appending p to the current Indent text.

default incrIndent :: Indentable (UnTrans d) => Trans d => d -> Indent -> d -> d Source #

hang :: Indent -> d -> d Source #

fill :: Width -> d -> d Source #

(fill w d) write d, then if d is not wider than w, write the difference with spaces.

default fill :: Indentable (UnTrans d) => Trans d => Width -> d -> d Source #

fillOrBreak :: Width -> d -> d Source #

(fillOrBreak w d) write d, then if d is not wider than w, write the difference with spaces otherwise write a newline indented to to the start Column of d plus w.

default fillOrBreak :: Indentable (UnTrans d) => Trans d => Width -> d -> d Source #

Instances

Instances details
Spaceable d => Indentable (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

align :: Plain d -> Plain d Source #

setIndent :: Plain d -> Indent -> Plain d -> Plain d Source #

incrIndent :: Plain d -> Indent -> Plain d -> Plain d Source #

hang :: Indent -> Plain d -> Plain d Source #

fill :: Width -> Plain d -> Plain d Source #

fillOrBreak :: Width -> Plain d -> Plain d Source #

class Listable d where Source #

Minimal complete definition

Nothing

Methods

ul :: Traversable f => f d -> d Source #

default ul :: Listable (UnTrans d) => Trans d => Traversable f => f d -> d Source #

ol :: Traversable f => f d -> d Source #

default ol :: Listable (UnTrans d) => Trans d => Traversable f => f d -> d Source #

Instances

Instances details
(Spaceable d, From (Word Char) d, From (Word String) d) => Listable (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

ul :: Traversable f => f (Plain d) -> Plain d Source #

ol :: Traversable f => f (Plain d) -> Plain d Source #

Class Wrappable

class Wrappable d where Source #

Minimal complete definition

setWidth

Methods

setWidth :: Maybe Width -> d -> d Source #

breakpoint :: d Source #

default breakpoint :: Wrappable (UnTrans d) => Trans d => d Source #

breakspace :: d Source #

default breakspace :: Wrappable (UnTrans d) => Trans d => d Source #

breakalt :: d -> d -> d Source #

default breakalt :: Wrappable (UnTrans d) => Trans d => d -> d -> d Source #

endline :: d Source #

default endline :: Wrappable (UnTrans d) => Trans d => d Source #

Instances

Instances details
Spaceable d => Wrappable (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Class Justifiable

class Justifiable d where Source #

Methods

justify :: d -> d Source #

Instances

Instances details
Spaceable d => Justifiable (Plain d) Source # 
Instance details

Defined in Symantic.Document.Plain

Methods

justify :: Plain d -> Plain d Source #

Class Trans

class Trans repr where Source #

Minimal complete definition

noTrans, unTrans

Associated Types

type UnTrans repr :: Type Source #

Return the underlying repr of the transformer.

Methods

noTrans :: UnTrans repr -> repr Source #

Lift a repr to the transformer's.

unTrans :: repr -> UnTrans repr Source #

Unlift a repr from the transformer's.

noTrans1 :: (UnTrans repr -> UnTrans repr) -> repr -> repr Source #

Identity transformation for a unary symantic method.

noTrans2 :: (UnTrans repr -> UnTrans repr -> UnTrans repr) -> repr -> repr -> repr Source #

Identity transformation for a binary symantic method.

noTrans3 :: (UnTrans repr -> UnTrans repr -> UnTrans repr -> UnTrans repr) -> repr -> repr -> repr -> repr Source #

Identity transformation for a ternary symantic method.