| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Aihc.Parser.Shorthand
Description
This module provides a compact, human-readable representation of parsed
AST structures via the Shorthand typeclass. Key features:
- Source spans are omitted to reduce noise
- Empty fields (Nothing, [], False, etc.) are omitted
- Output is on a single line by default
- Uses the prettyprinter library for consistent formatting
Example:
>>>shorthand $ parseModule defaultConfig "module Demo where x = 1"ParseOk (Module {name = "Demo", decls = [DeclValue (FunctionBind "x" [Match {rhs = UnguardedRhs (EInt 1)}])]})
Documentation
class Shorthand a where Source #
Typeclass for compact, human-readable AST representations.
The shorthand method produces a Doc that can be rendered to text
or shown as a string. This is useful for debugging and golden tests.
Use show on the result of shorthand to get a String:
show (shorthand expr) :: String
Instances
| Shorthand LexToken Source # | |
| Shorthand LexTokenKind Source # | |
Defined in Aihc.Parser.Shorthand Methods shorthand :: LexTokenKind -> Doc () Source # | |
| Shorthand Expr Source # | |
| Shorthand Module Source # | |
| Shorthand Pattern Source # | |
| Shorthand Type Source # | |
| Shorthand a => Shorthand (ParseResult a) Source # | |
Defined in Aihc.Parser.Shorthand Methods shorthand :: ParseResult a -> Doc () Source # | |