{-# LANGUAGE OverloadedStrings #-}
module Prettyprinter.Custom ( brackets'
, braces'
, parens'
, sexp
) where
import Prettyprinter
section' :: Doc a -> Doc a -> Doc a -> Doc a
section' :: Doc a -> Doc a -> Doc a -> Doc a
section' Doc a
c1 Doc a
c2 Doc a
d = Doc a -> Doc a
forall ann. Doc ann -> Doc ann
group (Doc a -> Doc a) -> Doc a -> Doc a
forall a b. (a -> b) -> a -> b
$ Int -> Doc a -> Doc a
forall ann. Int -> Doc ann -> Doc ann
nest Int
2 (Doc a
c1 Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
d) Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
c2
section :: Doc a -> Doc a -> Doc a -> Doc a
section :: Doc a -> Doc a -> Doc a -> Doc a
section Doc a
c1 Doc a
c2 = Doc a -> Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a -> Doc a
section' (Doc a
c1 Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
forall ann. Doc ann
line) (Doc a
forall ann. Doc ann
line Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
c2)
brackets' :: Doc a -> Doc a
brackets' :: Doc a -> Doc a
brackets' = Doc a -> Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a -> Doc a
section Doc a
"[" Doc a
"]"
braces' :: Doc a -> Doc a
braces' :: Doc a -> Doc a
braces' = Doc a -> Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a -> Doc a
section Doc a
"{" Doc a
"}"
parens' :: Doc a -> Doc a
parens' :: Doc a -> Doc a
parens' = Doc a -> Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a -> Doc a
section Doc a
"(" Doc a
")"
sexp :: Doc a -> [Doc a] -> Doc a
sexp :: Doc a -> [Doc a] -> Doc a
sexp Doc a
a [Doc a]
es =
Doc a -> Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a -> Doc a
section' (Doc a
"(" Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
a Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
forall ann. Doc ann
line) (Doc a
forall ann. Doc ann
line' Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
")") ([Doc a] -> Doc a
forall ann. [Doc ann] -> Doc ann
sep [Doc a]
es)