syntactic-1.4: Generic abstract syntax, and utilities for embedded languages

Safe HaskellNone

Language.Syntactic.Interpretation.Render

Synopsis

Documentation

class Render expr whereSource

Render an expression as concrete syntax. A complete instance must define either of the methods render and renderArgs.

Methods

render :: expr a -> StringSource

Render an expression as a String

renderArgs :: [String] -> expr a -> StringSource

Render a partially applied expression given a list of rendered missing arguments

Instances

Render Semantics 
Render Empty 
Render Condition 
Render Construct 
Render Identity 
Render Literal 
Render Select 
Render Tuple 
Render Let 
Render Lambda 
Render Variable 
Render Node 
Render dom => Render (AST dom) 
Monad m => Render (MONAD m) 
(Render expr1, Render expr2) => Render (:+: expr1 expr2) 
Render dom => Render (:|| dom pred) 
Render dom => Render (:| dom pred) 
Render expr => Render (Decor info expr) 
Render dom => Render (SubConstr1 c dom p) 
Render dom => Render (SubConstr2 c dom pa pb) 

printExpr :: Render expr => expr a -> IO ()Source

Print an expression

class Render expr => ToTree expr whereSource

Methods

toTreeArgs :: [Tree String] -> expr a -> Tree StringSource

Convert a partially applied expression to a syntax tree given a list of rendered missing arguments

Instances

ToTree Empty 
ToTree Condition 
ToTree Construct 
ToTree Identity 
ToTree Literal 
ToTree Select 
ToTree Tuple 
ToTree Let 
ToTree Lambda 
ToTree Variable 
ToTree Node 
(Render (AST dom), ToTree dom) => ToTree (AST dom) 
(Render (MONAD m), Monad m) => ToTree (MONAD m) 
(Render (:+: expr1 expr2), ToTree expr1, ToTree expr2) => ToTree (:+: expr1 expr2) 
(Render (:|| dom pred), ToTree dom) => ToTree (:|| dom pred) 
(Render (:| dom pred), ToTree dom) => ToTree (:| dom pred) 
(Render (Decor info expr), ToTree expr) => ToTree (Decor info expr) 
(Render (SubConstr1 c dom p), ToTree dom) => ToTree (SubConstr1 c dom p) 
(Render (SubConstr2 c dom pa pb), ToTree dom) => ToTree (SubConstr2 c dom pa pb) 

showAST :: ToTree dom => AST dom a -> StringSource

Show syntax tree using ASCII art

drawAST :: ToTree dom => AST dom a -> IO ()Source

Print syntax tree using ASCII art