|
definition: |
showBasicTerm :: Bool -> Term -> String
showBasicTerm _ (Var i) = 'x' : show i
showBasicTerm _ (Func _ f []) = showOperator f
showBasicTerm withp (Func _ f [x]) =
encloseInPar withp (showOperator f ++ ' ':showBasicTerm True x)
showBasicTerm withp (Func _ f args@(_:_:_))
| f == "LET" = encloseInPar withp ("let\n" ++ showLetExp args)
| f == "LAMBDA" = encloseInPar withp (showLambdaExp args)
| take 2 f == "(,"
= '(' : intercalate "," (map (showBasicTerm False) args) ++ ")"
| not (isAlpha (head f)) && length args == 2
= encloseInPar withp
(showBasicTerm True (head args) ++ ' ':f ++
' ':showBasicTerm True (args!!1))
| otherwise
= encloseInPar withp (showOperator f ++
concatMap (\a -> ' ':showBasicTerm True a) args)
|
|
demand: |
argument 2 |
|
deterministic: |
deterministic operation |
|
documentation: |
show a term (first argument: enclose in parentheses?) |
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,{Var}) |-> {:} || (_,{Func}) |-> _}
|
|
name: |
showBasicTerm |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
Prelude.Bool -> Term -> String |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |