Hoogle Search
Within LTS Haskell 24.33 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
package
prettyprinter-combinators Some useful combinators for the prettyprinter package Various utilities that make writing Pretty instances easier. Notable utilites include automatic deriving of Pretty instance via Generic, Data, or Show instance.
-
Efficient interpolation for Prettyprinter This package provides efficient interpolation of string-interpolate quasi quoters when used with prettyprinter.
data
SExprPrinter atom carriers-cargot Data.SCargot A SExprPrinter value describes how to print a given value as an s-expression. The carrier type parameter indicates the value that will be printed, and the atom parameter indicates the type that will represent tokens in an s-expression structure.
basicPrint :: (atom -> Text) -> SExprPrinter atom (SExpr atom)s-cargot Data.SCargot A default SExprPrinter struct that will always swing subsequent expressions onto later lines if they're too long, indenting them by two spaces, and uses a soft maximum width of 80 characters
flatPrint :: (atom -> Text) -> SExprPrinter atom (SExpr atom)s-cargot Data.SCargot A default SExprPrinter struct that will always print a SExpr as a single line.
unconstrainedPrint :: (atom -> Text) -> SExprPrinter atom (SExpr atom)s-cargot Data.SCargot A default SExprPrinter struct that will always swing subsequent expressions onto later lines if they're too long, indenting them by two spaces, but makes no effort to keep the pretty-printed sources inside a maximum width. In the case that we want indented printing but don't care about a "maximum" width, we can print more efficiently than in other situations.
basicPrinter :: SExprPrinter Text (SExpr Text)s-cargot Data.SCargot.Language.Basic A SExprPrinter that prints textual atoms directly (without quoting or any other processing) onto a single line.
>>> encode basicPrinter [L [A "1", A "elephant"]] "(1 elephant)"
locatedBasicPrinter :: SExprPrinter (Located Text) (SExpr (Located Text))s-cargot Data.SCargot.Language.Basic A SExprPrinter for Located values. Works exactly like basicPrinter It ignores the location tags when printing the result.
>>> let (Right dec) = decode locatedBasicParser $ pack "(1 elephant)" [SCons (SAtom (At (Span (line 1, column 2) (line 1, column 3)) "1")) (SCons (SAtom (At (Span (line 1, column 4) (line 1, column 12)) "elephant")) SNil)]
>>> encode locatedBasicPrinter dec "(1 elephant)"
haskLikePrinter :: SExprPrinter HaskLikeAtom (SExpr HaskLikeAtom)s-cargot Data.SCargot.Language.HaskLike This SExprPrinter emits s-expressions that contain Scheme-like tokens as well as string literals, integer literals, and floating-point literals, which will be emitted as the literals produced by Haskell's show function. This printer will produce a flat s-expression with no indentation of any kind.
>>> encode haskLikePrinter [L [A (HSInt 1), A (HSString "elephant")]] "(1 \"elephant\")"
locatedHaskLikePrinter :: SExprPrinter (Located HaskLikeAtom) (SExpr (Located HaskLikeAtom))s-cargot Data.SCargot.Language.HaskLike A SExprPrinter for Located values. Works exactly like haskLikePrinter It ignores the location tags when printing the result.
>>> let (Right dec) = decode locatedHaskLikeParser $ pack "(1 elephant)" [SCons (SAtom (At (Span (line 1, column 2) (line 1, column 3)) (HSInt 1))) (SCons (SAtom (At (Span (line 1, column 4) (line 1, column 12)) (HSIdent "elephant"))) SNil)]
>>> encode locatedHaskLikePrinter dec "(1 elephant)"