CurryInfo: javascript-3.0.0 / Language.JavaScript.Show.showJSStat

definition:
showJSStat :: Int -> JSStat -> String
showJSStat i (JSAssign e1 e2) =
  blanks i ++ showJSExp e1 ++ " = " ++ showJSExp e2 ++";"
showJSStat i (JSIf e s1 s2) =
  blanks i ++ "if (" ++ showJSExp e ++ ") {\n" ++
  concatMap (( ++ "\n") . (showJSStat (i+2))) s1  ++
  if null s2
  then blanks i ++ "}"
  else blanks i ++ "} else {\n" ++
       concatMap ((++"\n") . (showJSStat (i+2))) s2 ++
       blanks i ++ "}"
showJSStat i (JSSwitch e bs) =
  blanks i ++ "switch ("++showJSExp e++") {\n"++
  concatMap showJSBranch bs ++
  blanks i ++ "}"
 where
  showJSBranch (JSCase cs bstats) =
     blanks (i+2) ++ "case \"" ++ cs ++ "\" :\n" ++
     concatMap ((++"\n") . (showJSStat (i+4))) bstats ++
     blanks (i+4) ++ "break;\n"
  showJSBranch (JSDefault bstats) =
     blanks (i+2) ++ "default :\n" ++
     concatMap ((++"\n") . (showJSStat (i+4))) bstats

showJSStat i (JSPCall p args) =
  blanks i ++ p ++ "(" ++ intercalate "," (map showJSExp args) ++ ")"
showJSStat i (JSReturn e) = blanks i ++ "return " ++ showJSExp e ++";"
showJSStat i (JSVarDecl vi) = blanks i ++ "var x" ++ show vi ++";"
demand:
argument 2
deterministic:
deterministic operation
documentation:
--- Shows a JavaScript statement as a string in JavaScript syntax
--- with indenting.
--- @param i - number of spaces to indent this statement
--- @param jstat - the JavaScript statement to print
failfree:
(_, _)
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,{JSAssign}) |-> _ || (_,{JSIf}) |-> _ || (_,{JSSwitch}) |-> _ || (_,{JSPCall}) |-> _ || (_,{JSReturn}) |-> _ || (_,{JSVarDecl}) |-> _}
name:
showJSStat
precedence:
no precedence defined
result-values:
_
signature:
Prelude.Int -> Language.JavaScript.Types.JSStat -> String
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term