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

Exported operations:

showGoExpr :: GoExpr -> String   

Shows a Go expression as a string in Go syntax.

showGoStat :: Int -> GoStat -> String   

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   

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   

Shows a Go program as a string in Go syntax.

showGoImports :: [String] -> String   

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

showGoTopLevelDecl :: GoTopLevelDecl -> String   

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

showGoFuncDecl :: GoFuncDecl -> String   

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

showGoParam :: GoParam -> String   

Shows a Go parameter as a string in Go syntax.

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

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   

Creates a string of blanks with length 4*n