| Copyright | Copyright (c) 2016 the Hakaru team |
|---|---|
| License | BSD3 |
| Maintainer | wren@community.haskell.org |
| Stability | experimental |
| Portability | GHC-only |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.Hakaru.Pretty.Haskell
Description
- pretty :: ABT Term abt => abt '[] a -> Doc
- prettyPrec :: ABT Term abt => Int -> abt '[] a -> Doc
- prettyAssoc :: ABT Term abt => Assoc (abt '[]) -> Doc
- prettyPrecAssoc :: ABT Term abt => Int -> Assoc (abt '[]) -> Doc
- ppVariable :: Variable (a :: Hakaru) -> Doc
- ppVariables :: List1 Variable (xs :: [Hakaru]) -> Docs
- ppBinder :: ABT Term abt => abt xs a -> Docs
- ppCoerceTo :: ABT Term abt => Int -> Coercion a b -> abt '[] a -> Docs
- ppUnsafeFrom :: ABT Term abt => Int -> Coercion a b -> abt '[] b -> Docs
- ppRatio :: (Show a, Integral a) => Int -> Ratio a -> Doc
- data Associativity
- ppBinop :: ABT Term abt => String -> Int -> Associativity -> Int -> abt '[] a -> abt '[] b -> Docs
- class Pretty f where
The user-facing API
prettyPrec :: ABT Term abt => Int -> abt '[] a -> Doc Source #
Pretty-print a term at a given precendence level.
prettyAssoc :: ABT Term abt => Assoc (abt '[]) -> Doc Source #
Pretty-print a variable/term association pair.
prettyPrecAssoc :: ABT Term abt => Int -> Assoc (abt '[]) -> Doc Source #
Pretty-print an association at a given precendence level.
Helper functions (semi-public internal API)
ppVariables :: List1 Variable (xs :: [Hakaru]) -> Docs Source #
Pretty-print a list of variables as a list of variables. N.B., the output is not valid Haskell code since it uses the special built-in list syntax rather than using the List1 constructors...
ppBinder :: ABT Term abt => abt xs a -> Docs Source #
Pretty-print Hakaru binders as a Haskell lambda, as per our HOAS API.
ppRatio :: (Show a, Integral a) => Int -> Ratio a -> Doc Source #
Something prettier than rational. This works correctly
for both Rational and NonNegativeRational, though it may not
work for other a types.
N.B., the resulting string assumes prefix negation and the
Fractional (/) operator are both in scope.
data Associativity Source #
Constructors
| LeftAssoc | |
| RightAssoc | |
| NonAssoc |
ppBinop :: ABT Term abt => String -> Int -> Associativity -> Int -> abt '[] a -> abt '[] b -> Docs Source #
Minimal complete definition
Methods
prettyPrec_ :: Int -> f a -> Docs Source #
A polymorphic variant if prettyPrec, for internal use.