Safe Haskell | None |
---|
Equality and rendering of AST
s
- class Equality e where
- class Render sym where
- renderSym :: sym sig -> String
- renderArgs :: [String] -> sym sig -> String
- renderArgsSmart :: Render sym => [String] -> sym a -> String
- render :: forall sym a. Render sym => ASTF sym a -> String
- class Render sym => StringTree sym where
- stringTreeSym :: [Tree String] -> sym a -> Tree String
- stringTree :: forall sym a. StringTree sym => ASTF sym a -> Tree String
- showAST :: StringTree sym => ASTF sym a -> String
- drawAST :: StringTree sym => ASTF sym a -> IO ()
- writeHtmlAST :: StringTree sym => FilePath -> ASTF sym a -> IO ()
- equalDefault :: Render sym => sym a -> sym b -> Bool
- hashDefault :: Render sym => sym a -> Hash
- interpretationInstances :: Name -> DecsQ
Equality
Higher-kinded equality
equal :: e a -> e b -> BoolSource
Higher-kinded equality
Comparing elements of different types is often needed when dealing with expressions with existentially quantified sub-terms.
Higher-kinded hashing. Elements that are equal according to equal
must result in the same
hash:
equal a b ==> hash a == hash b
Equality Empty | |
Equality BindingT |
|
Equality Binding |
|
Equality Construct | |
Equality sym => Equality (AST sym) | |
Equality (MONAD m) | |
(Equality sym1, Equality sym2) => Equality (:+: sym1 sym2) | |
Equality expr => Equality (:&: expr info) |
Rendering
Render a symbol as concrete syntax. A complete instance must define at least the renderSym
method.
renderArgsSmart :: Render sym => [String] -> sym a -> StringSource
Implementation of renderArgs
that handles infix operators
class Render sym => StringTree sym whereSource
Convert a symbol to a Tree
of strings
stringTreeSym :: [Tree String] -> sym a -> Tree StringSource
Convert a symbol to a Tree
given a list of argument trees
StringTree Empty | |
StringTree BindingT | |
StringTree Binding | |
StringTree Construct | |
StringTree (MONAD m) | |
(StringTree sym1, StringTree sym2) => StringTree (:+: sym1 sym2) | |
StringTree expr => StringTree (:&: expr info) |
stringTree :: forall sym a. StringTree sym => ASTF sym a -> Tree StringSource
showAST :: StringTree sym => ASTF sym a -> StringSource
Show a syntax tree using ASCII art
drawAST :: StringTree sym => ASTF sym a -> IO ()Source
Print a syntax tree using ASCII art
writeHtmlAST :: StringTree sym => FilePath -> ASTF sym a -> IO ()Source
Write a syntax tree to an HTML file with foldable nodes
Default interpretation
equalDefault :: Render sym => sym a -> sym b -> BoolSource
Default implementation of equal
hashDefault :: Render sym => sym a -> HashSource
Default implementation of hash
interpretationInstances :: Name -> DecsQSource
Derive instances for Equality
and StringTree