Module Language.Go.Show

This library contains a simple pretty printer for showing Go programs.

Author: Jonas Boehm

Version: November 2020

Summary of exported operations:

showGoExpr :: GoExpr -> String  Deterministic 
Shows a Go expression as a string in Go syntax.
showGoStat :: Int -> GoStat -> String  Deterministic 
Shows a Go statement as a string in Go syntax with indenting.
goShowExprBranch :: Int -> GoExprBranch -> String  Deterministic 
Shows a Go expression branch as a String in Go Syntax.
showGoProg :: GoProg -> String  Deterministic 
Shows a Go program as a string in Go syntax.
showGoImports :: [String] -> String  Deterministic 
Shows a list of imports as a string in Go syntax.
showGoTopLevelDecl :: GoTopLevelDecl -> String  Deterministic 
Shows a Go top-level declaration as a string in Go syntax.
showGoFuncDecl :: GoFuncDecl -> String  Deterministic 
Shows a Go function declaration as a string in Go syntax.
showGoParam :: GoParam -> String  Deterministic 
Shows a Go parameter as a string in Go syntax.
showGoCommaList :: (a -> String) -> [a] -> String  Deterministic 
Shows a List of a Go type as a comma separated list in go syntax.
indent :: Int -> String  Deterministic 
Creates a string of blanks with length 4*n

Exported operations:

showGoExpr :: GoExpr -> String  Deterministic 

Shows a Go expression as a string in Go syntax.

showGoStat :: Int -> GoStat -> String  Deterministic 

Shows a Go statement as a string in Go syntax with indenting.

Example call:
(showGoStat n gostat)
Parameters:
  • n : number of spaces to indent
  • gostat : the Go statement to show

goShowExprBranch :: Int -> GoExprBranch -> String  Deterministic 

Shows a Go expression branch as a String in Go Syntax.

Example call:
(goShowExprBranch n branch)
Parameters:
  • n : number of spaces to indent
  • branch : branch to show

showGoProg :: GoProg -> String  Deterministic 

Shows a Go program as a string in Go syntax.

showGoImports :: [String] -> String  Deterministic 

Shows a list of imports as a string in Go syntax.

showGoTopLevelDecl :: GoTopLevelDecl -> String  Deterministic 

Shows a Go top-level declaration as a string in Go syntax.

showGoFuncDecl :: GoFuncDecl -> String  Deterministic 

Shows a Go function declaration as a string in Go syntax.

showGoParam :: GoParam -> String  Deterministic 

Shows a Go parameter as a string in Go syntax.

showGoCommaList :: (a -> String) -> [a] -> String  Deterministic 

Shows a List of a Go type as a comma separated list in go syntax.

Example call:
(showGoCommaList f list)
Parameters:
  • f : function to show the Go type as a string in go syntax
  • list : list of a Go type

indent :: Int -> String  Deterministic 

Creates a string of blanks with length 4*n