definition: |
ppExpr :: Options -> Int -> Expr -> Doc ppExpr _ _ (Var v) = ppVarIndex v ppExpr _ _ (Lit l) = ppLiteral l ppExpr o p (Comb _ qn es) = ppComb o p qn es ppExpr o p (Free vs e) | null vs = ppExpr o p e | otherwise = parensIf (p > 0) $ sep [ text "let" <+> sep (punctuate comma (map ppVarIndex vs)) <+> text "free" , text "in" </> ppExp o e ] ppExpr o p (Let ds e) = parensIf (p > 0) $ (if length ds > 1 then vsep else sep) [ text "let" <+> ppDecls o ds , text "in" <+> ppExp o e ] ppExpr o p (Or e1 e2) = parensIf (p > 0) $ ppExpr o 1 e1 <+> text "?" <+> ppExpr o 1 e2 ppExpr o p (Case ct e bs) = parensIf (p > 0) $ indent o $ ppCaseType ct <+> ppExpr o 1 e <+> text "of" $$ vsep (map (ppBranch o) bs) ppExpr o p (Typed e ty) = parensIf (p > 0) $ ppExp o e <+> text "::" <+> ppTypeExp o ty |
demand: |
argument 3 |
deterministic: |
deterministic operation |
documentation: |
--- pretty-print an expression |
failfree: |
<FAILING> |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,_,{Var}) |-> _ || (_,_,{Lit}) |-> {Doc} || (_,_,{Comb}) |-> _ || (_,_,{Free}) |-> _ || (_,_,{Let}) |-> _ || (_,_,{Or}) |-> _ || (_,_,{Case}) |-> _ || (_,_,{Typed}) |-> _} |
name: |
ppExpr |
precedence: |
no precedence defined |
result-values: |
_ |
signature: |
Options -> Prelude.Int -> FlatCurry.Types.Expr -> Text.PrettyImpl.Doc |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
possibly non-reducible on same data term |