hakaru-0.3.0: A probabilistic programming language

CopyrightCopyright (c) 2016 the Hakaru team
LicenseBSD3
Maintainerwren@community.haskell.org
Stabilityexperimental
PortabilityGHC-only
Safe HaskellNone
LanguageHaskell2010

Language.Hakaru.Pretty.Haskell

Contents

Description

 

Synopsis

The user-facing API

pretty :: ABT Term abt => abt '[] a -> Doc Source #

Pretty-print a term.

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)

ppVariable :: Variable (a :: Hakaru) -> Doc Source #

Pretty-print a variable.

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.

ppCoerceTo :: ABT Term abt => Int -> Coercion a b -> abt '[] a -> Docs Source #

ppUnsafeFrom :: ABT Term abt => Int -> Coercion a b -> abt '[] b -> Docs Source #

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 where Source #

Minimal complete definition

prettyPrec_

Methods

prettyPrec_ :: Int -> f a -> Docs Source #

A polymorphic variant if prettyPrec, for internal use.

Instances

Pretty Literal Source # 

Methods

prettyPrec_ :: Int -> Literal a -> Docs Source #

Pretty (Pattern xs) Source # 

Methods

prettyPrec_ :: Int -> Pattern xs a -> Docs Source #

Pretty f => Pretty (Datum f) Source # 

Methods

prettyPrec_ :: Int -> Datum f a -> Docs Source #

ABT Hakaru Term abt => Pretty (LC_ abt) Source # 

Methods

prettyPrec_ :: Int -> LC_ abt a -> Docs Source #

ABT Hakaru Term abt => Pretty (Branch a abt) Source # 

Methods

prettyPrec_ :: Int -> Branch a abt a -> Docs Source #