Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 -> Bool Source
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 Source | |
Equality Let Source | |
Equality BindingT Source |
|
Equality Binding Source |
|
Equality Construct Source | |
Equality Tuple Source | |
Equality sym => Equality (Typed sym) Source | |
Equality sym => Equality (AST sym) Source | |
Equality (MONAD m) Source | |
(Equality sym1, Equality sym2) => Equality ((:+:) sym1 sym2) Source | |
Equality expr => Equality ((:&:) expr info) Source |
Rendering
Render a symbol as concrete syntax. A complete instance must define at least the renderSym
method.
renderArgsSmart :: Render sym => [String] -> sym a -> String Source
Implementation of renderArgs
that handles infix operators
class Render sym => StringTree sym where Source
Convert a symbol to a Tree
of strings
Nothing
stringTreeSym :: [Tree String] -> sym a -> Tree String Source
Convert a symbol to a Tree
given a list of argument trees
StringTree Empty Source | |
StringTree Let Source | |
StringTree BindingT Source | |
StringTree Binding Source | |
StringTree Construct Source | |
StringTree Tuple Source | |
StringTree sym => StringTree (Typed sym) Source | |
StringTree (MONAD m) Source | |
(StringTree sym1, StringTree sym2) => StringTree ((:+:) sym1 sym2) Source | |
StringTree expr => StringTree ((:&:) expr info) Source |
stringTree :: forall sym a. StringTree sym => ASTF sym a -> Tree String Source
showAST :: StringTree sym => ASTF sym a -> String Source
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 -> Bool Source
Default implementation of equal
hashDefault :: Render sym => sym a -> Hash Source
Default implementation of hash
interpretationInstances :: Name -> DecsQ Source
Derive instances for Equality
and StringTree