morley-prelude-0.6.0: A custom prelude used in Morley
Safe HaskellSafe-Inferred
LanguageHaskell2010

Fmt.Buildable

Description

Partially implements the interface provided by the fmt package on top of prettyprinter.

Synopsis

Documentation

class Buildable a where Source #

A thing that can be prettyprinted in human-readable (but not necessarily machine-readable) format

Minimal complete definition

Nothing

Methods

build :: a -> Doc Source #

Make a document with human-readable representation

default build :: (Generic a, GBuildable (Rep a)) => a -> Doc Source #

buildList :: [a] -> Doc Source #

Used to avoid overlapping instances with String, cf. showList.

Instances

Instances details
Buildable Void Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Void -> Doc Source #

buildList :: [Void] -> Doc Source #

Buildable Int16 Source # 
Instance details

Defined in Fmt.Buildable

Buildable Int32 Source # 
Instance details

Defined in Fmt.Buildable

Buildable Int64 Source # 
Instance details

Defined in Fmt.Buildable

Buildable Int8 Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Int8 -> Doc Source #

buildList :: [Int8] -> Doc Source #

Buildable Word16 Source # 
Instance details

Defined in Fmt.Buildable

Buildable Word32 Source # 
Instance details

Defined in Fmt.Buildable

Buildable Word64 Source # 
Instance details

Defined in Fmt.Buildable

Buildable Word8 Source # 
Instance details

Defined in Fmt.Buildable

Buildable IntSet Source #
>>> pretty (fromList [100, 500] :: IntSet)
[100, 500]
Instance details

Defined in Fmt.Buildable

Buildable Doc Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Doc -> Doc Source #

buildList :: [Doc] -> Doc Source #

Buildable Text Source #

Differs from the corresponding Pretty instance in one important aspect. It converts newlines to hard lines.

>>> txt = "Hello,\nWorld!" :: Text
>>> Prettyprinter.group @() $ Prettyprinter.pretty txt
Hello, World!
>>> Prettyprinter.group $ build txt
Hello,
World!
Instance details

Defined in Fmt.Buildable

Methods

build :: Text -> Doc Source #

buildList :: [Text] -> Doc Source #

Buildable Builder Source # 
Instance details

Defined in Fmt.Buildable

Buildable LText Source #

Differs from the corresponding Pretty instance in one important aspect. It converts newlines to hard lines.

>>> txt = "Hello,\nWorld!" :: LText
>>> Prettyprinter.group @() $ Prettyprinter.pretty txt
Hello, World!
>>> Prettyprinter.group $ build txt
Hello,
World!
Instance details

Defined in Fmt.Buildable

Buildable Integer Source # 
Instance details

Defined in Fmt.Buildable

Buildable Natural Source # 
Instance details

Defined in Fmt.Buildable

Buildable () Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: () -> Doc Source #

buildList :: [()] -> Doc Source #

Buildable Bool Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Bool -> Doc Source #

buildList :: [Bool] -> Doc Source #

Buildable Char Source #

Differs from the corresponding Pretty instance in one important aspect. It converts newlines to hard lines. Thus,

>>> str = "Hello,\nWorld!" :: String
>>> Prettyprinter.group @() $ Prettyprinter.pretty str
Hello, World!
>>> Prettyprinter.group $ build str
Hello,
World!
Instance details

Defined in Fmt.Buildable

Methods

build :: Char -> Doc Source #

buildList :: [Char] -> Doc Source #

Buildable Double Source # 
Instance details

Defined in Fmt.Buildable

Buildable Float Source # 
Instance details

Defined in Fmt.Buildable

Buildable Int Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Int -> Doc Source #

buildList :: [Int] -> Doc Source #

Buildable Word Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Word -> Doc Source #

buildList :: [Word] -> Doc Source #

Buildable a => Buildable (Identity a) Source # 
Instance details

Defined in Fmt.Buildable

Buildable a => Buildable (Ratio a) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Ratio a -> Doc Source #

buildList :: [Ratio a] -> Doc Source #

Buildable v => Buildable (IntMap v) Source #
>>> pretty (fromList [(100, "bar"), (500, "quux")] :: IntMap Text)
{100: bar, 500: quux}
Instance details

Defined in Fmt.Buildable

Methods

build :: IntMap v -> Doc Source #

buildList :: [IntMap v] -> Doc Source #

Buildable v => Buildable (Set v) Source #
>>> pretty (fromList ["foo", "bar", "baz", "quux"] :: Set Text)
[bar, baz, foo, quux]
Instance details

Defined in Fmt.Buildable

Methods

build :: Set v -> Doc Source #

buildList :: [Set v] -> Doc Source #

(GBuildable (Rep a), Generic a) => Buildable (GenericBuildable a) Source # 
Instance details

Defined in Fmt.Buildable

Buildable a => Buildable (NonEmpty a) Source # 
Instance details

Defined in Fmt.Buildable

Buildable a => Buildable (Maybe a) Source #

One important quirk of this instance is it skips over Nothing values entirely:

>>> build $ [Just 1, Nothing, Just 3]
[1, 3]
Instance details

Defined in Fmt.Buildable

Methods

build :: Maybe a -> Doc Source #

buildList :: [Maybe a] -> Doc Source #

Buildable a => Buildable [a] Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: [a] -> Doc Source #

buildList :: [[a]] -> Doc Source #

(Buildable a, Buildable b) => Buildable (Either a b) Source #
>>> pretty (Left "foo" :: Either String Int)
<Left: foo>
>>> pretty (Right 123 :: Either String Int)
<Right: 123>
Instance details

Defined in Fmt.Buildable

Methods

build :: Either a b -> Doc Source #

buildList :: [Either a b] -> Doc Source #

(Buildable k, Buildable v) => Buildable (Map k v) Source #
>>> pretty (fromList [("foo", "bar"), ("baz", "quux")] :: Map Text Text)
{baz: quux, foo: bar}
Instance details

Defined in Fmt.Buildable

Methods

build :: Map k v -> Doc Source #

buildList :: [Map k v] -> Doc Source #

(Buildable a1, Buildable a2) => Buildable (a1, a2) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2) -> Doc Source #

buildList :: [(a1, a2)] -> Doc Source #

Buildable a => Buildable (Const a b) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: Const a b -> Doc Source #

buildList :: [Const a b] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3) => Buildable (a1, a2, a3) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3) -> Doc Source #

buildList :: [(a1, a2, a3)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4) => Buildable (a1, a2, a3, a4) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4) -> Doc Source #

buildList :: [(a1, a2, a3, a4)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5) => Buildable (a1, a2, a3, a4, a5) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6) => Buildable (a1, a2, a3, a4, a5, a6) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7) => Buildable (a1, a2, a3, a4, a5, a6, a7) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27, Buildable a28) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27, Buildable a28, Buildable a29) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)] -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27, Buildable a28, Buildable a29, Buildable a30) => Buildable (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30) Source # 
Instance details

Defined in Fmt.Buildable

Methods

build :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30) -> Doc Source #

buildList :: [(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30)] -> Doc Source #

class FromDoc a where Source #

A class of things that can be produced from Doc using the default layout engine. Mostly various text types.

Methods

fmt :: Doc -> a Source #

Render a Doc to another format.

>>> doc = "foo" :: Doc
>>> fmt doc :: Text
"foo"
>>> fmt doc :: LText
"foo"
>>> fmt doc :: String
"foo"
>>> fmt doc :: ByteString
"foo"
>>> fmt doc :: LByteString
"foo"
>>> fmt doc :: IO ()
foo
>>> fmt doc :: Data.Text.Lazy.Builder.Builder
"foo"
>>> Data.ByteString.Builder.toLazyByteString (fmt doc :: Data.ByteString.Builder.Builder)
"foo"

Instances

Instances details
FromDoc Builder Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> Builder Source #

FromDoc ByteString Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> ByteString Source #

FromDoc Doc Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> Doc Source #

FromDoc Text Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> Text Source #

FromDoc Builder Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> Builder Source #

FromDoc LByteString Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> LByteString Source #

FromDoc LText Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> LText Source #

FromDoc String Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> String Source #

a ~ () => FromDoc (IO a) Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmt :: Doc -> IO a Source #

class FromSimpleDoc a where Source #

Helper intermediary class to define FromDoc. The primary motivation for its existence is being able to override the default layout engine.

>>> :{
layoutNarrow =
  Prettyprinter.layoutPretty $ Prettyprinter.LayoutOptions $
    Prettyprinter.AvailablePerLine 20 1
:}
>>> doc = reflowF "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
>>> fmt doc
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
>>> fmtSimple $ layoutNarrow doc
Lorem ipsum dolor
sit amet,
consectetur
adipiscing elit.

Methods

fmtSimple :: SimpleDocStream ann -> a Source #

Instances

Instances details
FromSimpleDoc Builder Source # 
Instance details

Defined in Fmt.Buildable

FromSimpleDoc ByteString Source # 
Instance details

Defined in Fmt.Buildable

FromSimpleDoc Text Source # 
Instance details

Defined in Fmt.Buildable

FromSimpleDoc Builder Source # 
Instance details

Defined in Fmt.Buildable

FromSimpleDoc LByteString Source # 
Instance details

Defined in Fmt.Buildable

FromSimpleDoc LText Source # 
Instance details

Defined in Fmt.Buildable

FromSimpleDoc String Source # 
Instance details

Defined in Fmt.Buildable

a ~ () => FromSimpleDoc (IO a) Source # 
Instance details

Defined in Fmt.Buildable

Methods

fmtSimple :: SimpleDocStream ann -> IO a Source #

data ReflowingDoc Source #

Opaque type for reflowing brackets ++| |++.

Helpers

pretty :: (Buildable a, FromDoc b) => a -> b Source #

build then fmt. Convenience synonym for fmt . build.

prettyText :: Buildable a => a -> Text Source #

A less polymorphic version of pretty for convenience.

Brackets

(+|) :: FromDoc b => Doc -> Doc -> b infixr 1 Source #

Left format bracket. Enclose the value to format in these for concise syntax:

>>> :{
data WorldType = Cruel | Wonderful
  deriving (Generic, Buildable)
:}
>>> sayHello worldType = "Hello, " +| worldType |+ " world!"
>>> sayHello Cruel
Hello, Cruel world!
>>> sayHello Wonderful
Hello, Wonderful world!

(|+) :: (Buildable a, FromDoc b) => a -> Doc -> b infixr 1 Source #

Right format bracket

(|++) :: Buildable a => a -> Doc -> ReflowingDoc infixr 1 Source #

Bracket versions of enumerateF. Note that unlike with |+, both brackets are required.

>>> let splice = "lorem posuere dapibus in ut lorem." :: Doc
>>> let long_splice = splice <> " " <> splice
>>> :{
"Lorem ipsum dolor sit amet, consectetur adipiscing elit." ++| splice
  |++ "Morbi aliquet accumsan libero." ++| long_splice
  |++ "Consectetur adipiscing elit."
:}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
lorem posuere dapibus in ut lorem. Morbi aliquet accumsan libero.
lorem posuere dapibus in ut lorem. lorem posuere dapibus in ut lorem.
Consectetur adipiscing elit.
>>> let splice = build "lorem\nposuere\ndapibus"
>>> :{
"Lorem ipsum dolor sit amet, consectetur adipiscing elit." ++| splice |++
  "Morbi aliquet accumsan libero."
:}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
lorem
posuere
dapibus
Morbi aliquet accumsan libero.

(|++^) :: Buildable a => a -> Doc -> ReflowingDoc infixr 1 Source #

A version of the reflowing bracket that always breaks after a splice if there's a break before the splice.

Compare with the similar example for |++, notice the line break after splice. It may be combined with quoteOrIndentF.

>>> let splice = "lorem posuere dapibus in ut lorem." :: Doc
>>> let long_splice = splice <> " " <> splice
>>> :{
"Lorem ipsum dolor sit amet, consectetur adipiscing elit." ++| splice
  |++^ "Morbi aliquet accumsan libero." ++| long_splice
  |++^ "Consectetur adipiscing elit."
:}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
lorem posuere dapibus in ut lorem.
Morbi aliquet accumsan libero.
lorem posuere dapibus in ut lorem. lorem posuere dapibus in ut lorem.
Consectetur adipiscing elit.

(++|) :: FromDoc b => Text -> ReflowingDoc -> b infixr 1 Source #

Left formatting bracket.

Formatters

unlinesF :: (Foldable f, Buildable a) => f a -> Doc Source #

Join a Foldable with hardlines.

>>> Prettyprinter.group $ unlinesF ["foo", "bar", "baz"]
foo
bar
baz

unwordsF :: (Buildable a, Foldable f) => f a -> Doc Source #

Join a Foldable with spaces.

>>> unwordsF ["foo", "bar", "baz"]
foo bar baz

nameF :: Buildable a => Doc -> a -> Doc Source #

If name and content fit into the page width and content doesn't contain hard line breaks, layout as single line with : between. Otherwise, make a multiline layout, appending : to name, and nesting content by 2 spaces.

>>> nameF "Test" "foo"
Test: foo
>>> nameF "Test" $ fillSepF $ replicate 27 "foo"
Test:
  foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
  foo foo foo foo foo foo foo foo

If either name or content is empty, returns only the other one.

>>> nameF "" "foo"
foo
>>> nameF "Test" ""
Test

indentF :: Int -> Doc -> Doc Source #

Indent Doc by a given number of spaces.

>>> indentF 4 "foo"
    foo
>>> indentF 4 "foo\nbar"
    foo
    bar

blockMapF :: (Buildable k, Buildable v, IsList f, Item f ~ (k, v)) => f -> Doc Source #

Print a map-like thing in the style of a YAML map.

>>> blockMapF $ [("foo", "bar"), ("baz", "quux")]
foo: bar
baz: quux
>>> blockMapF ([] :: [(Text, Text)])
{}

blockMapF' :: (IsList f, Item f ~ (k, v)) => (k -> Doc) -> (v -> Doc) -> f -> Doc Source #

Version of blockMapF that allows explicitly passing functions to format key and value.

>>> blockMapF' hexF build $ [(123, "foo"), (456, "bar")]
7b: foo
1c8: bar

blockListF :: (Buildable a, Foldable f) => f a -> Doc Source #

Render a list-like thing, YAML style.

>>> blockListF ["foo", "bar", "baz"]
- foo
- bar
- baz
>>> blockListF ([] :: [Text])
[]

blockListF' :: Foldable f => Doc -> (a -> Doc) -> f a -> Doc Source #

Version of blockListF that allows explicitly passing a bullet style and formatter for items

>>> blockListF' "*" hexF [1,11,21]
* 1
* b
* 15

mapF :: (Buildable k, Buildable v, IsList f, Item f ~ (k, v)) => f -> Doc Source #

Format a map-like thing, JSON-style.

>>> mapF [("foo", "bar"), ("baz", "quux")]
{foo: bar, baz: quux}
>>> mapF ([] :: [(Text, Text)])
{}
>>> mapF $ replicate 9 ("foo", "bar")
{ foo: bar
, foo: bar
...
, foo: bar }
>>> mapF $ [("foo", "bar\nquux"), ("baz", "corge")]
{ foo:
    bar
    quux
, baz: corge }

mapF' :: (IsList f, Item f ~ (k, v)) => (k -> Doc) -> (v -> Doc) -> f -> Doc Source #

Version of mapF allowing for custom formatters.

>>> mapF' hexF build [(128, "foo"), (512, "bar")]
{80: foo, 200: bar}

listF :: (Buildable a, Foldable f) => f a -> Doc Source #

Print a list, JSON-style.

>>> listF [1..3]
[1, 2, 3]
>>> listF [1..100]
[ 1
, 2
...
, 100 ]
>>> listF ["foo", "bar\nbaz"]
[ foo
, bar
  baz ]

listF' :: Foldable f => (a -> Doc) -> f a -> Doc Source #

Version of listF that allows explicitly specifying a formatter for items.

>>> listF' hexF [1,11,21]
[1, b, 15]

whenF :: Bool -> Doc -> Doc Source #

Conditionally print something.

>>> whenF True "foo"
foo
>>> show $ whenF False "foo"
""

unlessF :: Bool -> Doc -> Doc Source #

Boolean inverse of whenF

>>> unlessF False "foo"
foo
>>> show $ unlessF True "foo"
""

enumerateF :: [(Text, Doc)] -> Doc Source #

Enumerate pairs of text and Doc, reflowing the content to best-fit line width. This will line-wrap text on whitespace. If Doc is rendered single-line, this will try to fit it inline. Otherwise, it's surrounded by newlines.

>>> :{
long_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. \
  \ Donec eget diam ac lorem posuere dapibus in ut lorem. Morbi \
  \ aliquet accumsan libero, a tempor nunc egestas ac."
:}
>>> enumerateF [(long_text, mempty)]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eget diam ac
lorem posuere dapibus in ut lorem. Morbi aliquet accumsan libero, a tempor nunc
egestas ac.
>>> let splice = "SPLICE SPLICE SPLICE" :: Doc
>>> :{
enumerateF
  [ (long_text, splice)
  , (long_text, mempty)
  ]
:}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eget diam ac
lorem posuere dapibus in ut lorem. Morbi aliquet accumsan libero, a tempor nunc
egestas ac. SPLICE SPLICE SPLICE Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Donec eget diam ac lorem posuere dapibus in ut lorem. Morbi
aliquet accumsan libero, a tempor nunc egestas ac.
>>> let splice = build "SPLICE\nSPLICE\nSPLICE"
>>> :{
enumerateF
  [ (long_text, splice)
  , ("Short text", mempty)
  ]
:}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eget diam ac
lorem posuere dapibus in ut lorem. Morbi aliquet accumsan libero, a tempor nunc
egestas ac.
SPLICE
SPLICE
SPLICE
Short text

enumerateF' :: Doc -> [(Text, Doc)] -> Doc Source #

Version of enumerateF that allows specifying separator between items.

>>> enumerateF' "," [("Foo", build 1), ("bar", build 2), ("baz", build 3)]
Foo 1, bar 2, baz 3

whenNE :: Monoid a => a -> Doc -> a Source #

When the second argument is empty, return mempty, otherwise, return the first argument.

fillSepF :: (Foldable t, Buildable a) => t a -> Doc Source #

Like fillSep, but skips over empty elements.

fillSepF' :: (Foldable t, Buildable a) => Doc -> t a -> Doc Source #

Version of fillSepF with punctuation.

reflowF :: Text -> Doc Source #

Reflow text, line-wrapping on white-space. Any leading and trailing whitespace is stripped.

singleLineF :: Buildable a => a -> Doc Source #

Force the Doc to be rendered on a single line, regardless of anything, including hard line breaks. Will lead to horrible terrible formatting if overused. In all likelihood, this is not the function you're looking for.

Note that hard line breaks will be removed entirely, not replaced with spaces.

>>> singleLineF ("foo\nbar\nbaz" :: Text)
foobarbaz

punctuateF Source #

Arguments

:: (Foldable t, Buildable a) 
=> Doc

Default separator, usually comma

-> Doc

Pair separator, usually " and" or " or"

-> t a

Foldable to punctuate

-> [Doc] 

Punctuate a foldable with a distinct separator for the last two elements. Useful for enumerations. Does the oxford comma by concatenating first and second arguments. Note that when using a word, a leading space is expected on the pair separator.

>>> fillSepF $ punctuateF "," " and" ([] :: [Doc])

>>> fillSepF $ punctuateF "," " and" ["foo"]
foo
>>> fillSepF $ punctuateF "," " and" ["bar", "baz"]
bar and baz
>>> fillSepF $ punctuateF "," " and" ["foo", "bar", "baz"]
foo, bar, and baz

punctuateF' Source #

Arguments

:: (Foldable t, Buildable a) 
=> Doc

Default separator

-> Doc

Pair separator

-> Doc

Penultimate element separator

-> t a 
-> [Doc] 

Version of punctuateF with explicit distinct separators for penultimate element and just two elements.

>>> fillSepF $ punctuateF' "," " and" ", and" ([] :: [Doc])

>>> fillSepF $ punctuateF' "," " and" ", and" ["foo"]
foo
>>> fillSepF $ punctuateF' "," " and" ", and" ["bar", "baz"]
bar and baz
>>> fillSepF $ punctuateF' "," " and" ", and" ["foo", "bar", "baz"]
foo, bar, and baz

quoteF :: Buildable a => Doc -> a -> Doc Source #

Surround a Buildable with the same Doc on both sides.

>>> quoteF "\"" "Foo"
"Foo"

quoteF' :: Buildable a => Doc -> Doc -> a -> Doc Source #

Surround a Buildable with quotes (or anything else really).

quoteF' l r x is equivalent to l <> build x <> r, but it may be more convenient in some cases.

>>> quoteF' "\"" "\"" "Foo"
"Foo"

quoteOrIndentF :: Buildable a => a -> Doc Source #

If buildable fits into the line, wrap it in single quotes. Otherwise, indent it by 2 spaces. This is convenient with enumerateF or reflowing brackets to format a splice that can be long and multiline or short and singleline with about equal probability.

This is a particularly useful specialization of flatAltF.

>>> let splice = "lorem posuere dapibus" :: Doc
>>> let long_splice = unwordsF $ replicate 3 splice
>>> let very_long_splice = unwordsF $ replicate 4 splice
>>> "Foobar" ++| quoteOrIndentF splice |++ "bazbar."
Foobar 'lorem posuere dapibus' bazbar.
>>> "Foobarbazquux" ++| quoteOrIndentF long_splice |++ "bazbar."
Foobarbazquux
'lorem posuere dapibus lorem posuere dapibus lorem posuere dapibus' bazbar.
>>> "Foobarbazquux" ++| quoteOrIndentF long_splice |++^ "bazbar."
Foobarbazquux
  lorem posuere dapibus lorem posuere dapibus lorem posuere dapibus
bazbar.
>>> "Foobar" ++| quoteOrIndentF very_long_splice |++ "bazbar."
Foobar
  lorem posuere dapibus lorem posuere dapibus lorem posuere dapibus
  lorem posuere dapibus
bazbar.
>>> "Foobar" ++| quoteOrIndentF very_long_splice |++^ "bazbar."
Foobar
  lorem posuere dapibus lorem posuere dapibus lorem posuere dapibus
  lorem posuere dapibus
bazbar.

flatAltF Source #

Arguments

:: (a -> Doc)

Multiline formatter

-> (a -> Doc)

Single-line formatter

-> a -> Doc 

Use different formatters depending on whether the pretty-printed representation fits on the current line or not. The exact meaning of "fits" is determined by the surrounding context. In precise terms, whether multiline or single-line format is chosen is determined by whether the enclosing group is broken or not, respectively. Useful with reflowing brackets, nameF, etc to specify alternate format for short andor single-line and long andor multiline text.

>>> let short = "bar baz" :: Text
>>> let long = unwordsF $ replicate 10 short
>>> nameF "Foo" $ flatAltF (quoteF "\"") (quoteF "'") short
Foo: 'bar baz'
>>> nameF "Foo" $ flatAltF (quoteF "\"") (quoteF "'") long
Foo:
  "bar baz bar baz bar baz bar baz bar baz bar baz bar baz bar baz bar baz
  bar baz"

class TupleF a where Source #

Class for formatting tuples

>>> tupleF ("foo", "bar", "baz")
(foo, bar, baz)
>>> tupleF ("foo","bar\nbaz")
( foo
, bar
  baz )
>>> :{
tupleF
  ( "foo", "foo", "foo", "foo", "foo"
  , "foo", "foo", "foo", "foo", "foo"
  , "foo", "foo", "foo", "foo", "foo"
  , "foo", "foo", "foo", "foo", "foo"
  )
:}
( foo
, foo
...
, foo )

Methods

tupleF :: a -> Doc Source #

Instances

Instances details
Buildable a => TupleF [a] Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: [a] -> Doc Source #

(Buildable a1, Buildable a2) => TupleF (a1, a2) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3) => TupleF (a1, a2, a3) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4) => TupleF (a1, a2, a3, a4) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5) => TupleF (a1, a2, a3, a4, a5) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6) => TupleF (a1, a2, a3, a4, a5, a6) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7) => TupleF (a1, a2, a3, a4, a5, a6, a7) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27, Buildable a28) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27, Buildable a28, Buildable a29) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) -> Doc Source #

(Buildable a1, Buildable a2, Buildable a3, Buildable a4, Buildable a5, Buildable a6, Buildable a7, Buildable a8, Buildable a9, Buildable a10, Buildable a11, Buildable a12, Buildable a13, Buildable a14, Buildable a15, Buildable a16, Buildable a17, Buildable a18, Buildable a19, Buildable a20, Buildable a21, Buildable a22, Buildable a23, Buildable a24, Buildable a25, Buildable a26, Buildable a27, Buildable a28, Buildable a29, Buildable a30) => TupleF (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30) Source # 
Instance details

Defined in Fmt.Buildable

Methods

tupleF :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30) -> Doc Source #

hexF

class FormatAsHex a where Source #

Methods

hexF :: a -> Doc Source #

Format a number or bytestring as hex:

>>> pretty $ hexF 3635
e33
>>> pretty $ hexF (-3635)
-e33
>>> pretty $ hexF ("\0\50\63\80" :: ByteString)
00323f50
>>> pretty $ hexF ("\0\50\63\80" :: LByteString)
00323f50

Instances

Instances details
FormatAsHex Int16 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Int16 -> Doc Source #

FormatAsHex Int32 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Int32 -> Doc Source #

FormatAsHex Int64 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Int64 -> Doc Source #

FormatAsHex Int8 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Int8 -> Doc Source #

FormatAsHex Word16 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Word16 -> Doc Source #

FormatAsHex Word32 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Word32 -> Doc Source #

FormatAsHex Word64 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Word64 -> Doc Source #

FormatAsHex Word8 Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Word8 -> Doc Source #

FormatAsHex ByteString Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: ByteString -> Doc Source #

FormatAsHex LByteString Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: LByteString -> Doc Source #

FormatAsHex Integer Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Integer -> Doc Source #

FormatAsHex Natural Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Natural -> Doc Source #

FormatAsHex Int Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Int -> Doc Source #

FormatAsHex Word Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Word -> Doc Source #

Integral a => FormatAsHex (Hex a) Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Hex a -> Doc Source #

newtype Hex a Source #

Wrap an integral type with this if there's no FormatAsHex instance for it yet, or use it with DerivingVia.

>>> hexF $ Hex 128
80

Constructors

Hex a 

Instances

Instances details
Integral a => FormatAsHex (Hex a) Source # 
Instance details

Defined in Fmt.Buildable

Methods

hexF :: Hex a -> Doc Source #

Generics

newtype GenericBuildable a Source #

Newtype for use with DerivingVia, e.g.

>>> :{
data Foo = Bar | Baz
  deriving (Generic, Buildable)
:}
>>> build Bar
Bar

Handles infix constructors properly:

>>> data Inf = Text :-> Text deriving (Generic, Buildable)
>>> build $ "foo" :-> "bar"
foo :-> bar
>>> data Inf2 = Text `Con` Text deriving (Generic, Buildable)
>>> build $ Con "foo" "bar"
foo `Con` bar
>>> :{
data LargeTy = LargeTy
  Text Text Text Text Text
  Text Text Text Text Text
  Text Text Text Text Text
  Text Text Text Text Text
  deriving (Generic, Buildable)
:}
>>> :{
build $ LargeTy
  "foo" "foo" "foo" "foo" "foo"
  "foo" "foo" "foo" "foo" "foo"
  "foo" "foo" "foo" "foo" "foo"
  "foo" "foo" "foo" "foo" "foo"
:}
LargeTy;
  foo,  foo,  foo,  foo,  foo,  foo,  foo,  foo,  foo,  foo,  foo,  foo,  foo,
  foo,  foo,  foo,  foo,  foo,  foo,  foo

There is a special case for tuples:

>>> :{
newtype Tup = Tup (Int, Int, Text)
  deriving stock Generic
  deriving anyclass Buildable
:}
>>> build $ Tup (1, 2, "many")
Tup; (1, 2, many)
>>> build $ Tup (1, 2, "many\nlines")
Tup;
  ( 1
  , 2
  , many
    lines )

Renders records as maps

>>> :{
data Rec = Rec
  { foo :: Text
  , bar :: Text
  , baz :: Text
  } deriving (Generic, Buildable)
:}
>>> build $ Rec "quux" "waldo" "corge"
Rec:
  foo: quux
  bar: waldo
  baz: corge

Constructors

GenericBuildable a 

Instances

Instances details
(GBuildable (Rep a), Generic a) => Buildable (GenericBuildable a) Source # 
Instance details

Defined in Fmt.Buildable

class GBuildable f where Source #

Methods

gbuild :: f a -> Doc Source #

Instances

Instances details
Buildable c => GBuildable (Rec0 c :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

gbuild :: forall (a :: k0). Rec0 c a -> Doc Source #

(GBuildable a, GBuildable b) => GBuildable (a :+: b :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

gbuild :: forall (a0 :: k0). (a :+: b) a0 -> Doc Source #

(GetFields a, Constructor c) => GBuildable (C1 c a :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

gbuild :: forall (a0 :: k0). C1 c a a0 -> Doc Source #

GBuildable a => GBuildable (D1 d a :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

gbuild :: forall (a0 :: k0). D1 d a a0 -> Doc Source #

class GetFields f where Source #

Helper class for GBuildable.

Methods

getFields :: f a -> [(String, Doc)] Source #

Get fields, together with their names if available

Instances

Instances details
GetFields (U1 :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

getFields :: forall (a :: k0). U1 a -> [(String, Doc)] Source #

(GetFields a, GetFields b) => GetFields (a :*: b :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

getFields :: forall (a0 :: k0). (a :*: b) a0 -> [(String, Doc)] Source #

(GBuildable a, Selector c) => GetFields (S1 c a :: k -> Type) Source # 
Instance details

Defined in Fmt.Buildable

Methods

getFields :: forall (a0 :: k0). S1 c a a0 -> [(String, Doc)] Source #