| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Snail.Ast
Constructors for AST
The bracket used to surround the s-expression
Utilities for AST
unwrap :: SnailAst -> SnailAst Source #
Unwrap nested s-expressions, this is very useful when you are converting
SnailAst to your own AST.
You'll likely have a function `snailAstToMyAst :: SnailAst -> m MyAst` where
m is ExceptT or MonadExcept. Then, your final case statement should
unwrap nested expressions to their base with,
snailAstToMyAst . unwrap . SExpression initialChar bracket $ unwrap $ exprs`
For example, `((read))` will become `SExpression _ _ [Lexeme (_, "read")]` which your AST converter should handle.