Copyright | Copyright (c) 2016 the Hakaru team |
---|---|
License | BSD3 |
Maintainer | wren@community.haskell.org |
Stability | experimental |
Portability | GHC-only |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- pretty :: ABT Term abt => abt '[] a -> Doc
- prettyString :: ABT Term abt => Sing a -> 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
- prettyType :: Sing (a :: Hakaru) -> 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 :: Hakaru -> *) 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.
ppBinop :: ABT Term abt => String -> Int -> Associativity -> Int -> abt '[] a -> abt '[] b -> Docs Source #
class Pretty (f :: Hakaru -> *) where Source #
prettyPrec_ :: Int -> f a -> Docs Source #
A polymorphic variant if prettyPrec
, for internal use.
Instances
Pretty Literal Source # | |
prettyPrec_ :: Int -> Literal a -> Docs Source # | |
Pretty (Pattern xs) Source # | |
prettyPrec_ :: Int -> Pattern xs a -> Docs Source # | |
Pretty f => Pretty (Datum f) Source # | |
prettyPrec_ :: Int -> Datum f a -> Docs Source # | |
ABT Term abt => Pretty (LC_ abt) Source # | |
prettyPrec_ :: Int -> LC_ abt a -> Docs Source # | |
ABT Term abt => Pretty (Reducer abt xs) Source # | |
prettyPrec_ :: Int -> Reducer abt xs a -> Docs Source # | |
ABT Term abt => Pretty (Branch a abt) Source # | |
prettyPrec_ :: Int -> Branch a abt a0 -> Docs Source # |