syntax-trees-fork-bairyn-0.1.2.5: Convert between different Haskell syntax trees. Bairyn's fork.

Safe HaskellNone
LanguageHaskell2010

Fork.Bairyn.Language.Haskell.SyntaxTrees.Main

Documentation

type Witness a = a Source

class Translation s t where Source

Methods

translateTree :: s -> Either s t Source

Translate a tree of type s to a tree of type t.

If translation fails then translate s = Left s, otherwise translate s = Right t where t is the translated tree.

parseToTarget :: Witness s -> String -> Either String t Source

Parse a string to a tree of type t, via intermediate representation as a tree of type s. Requires a witness of the intermediate type s to be passed as the first argument.

If parsing fails then parseToTarget s = Left s, otherwise parseToTarget s = Right t where t is the parsed tree.

Instances