Metastatic.Adapters.Haskell.ToMeta (Metastatic v0.10.4)

View Source

Transform Haskell AST (M1) to MetaAST (M2).

Implements the abstraction function α_Haskell that lifts Haskell-specific AST structures to the meta-level representation.

3-Tuple Format

All MetaAST nodes use the uniform 3-tuple structure: {type_atom, keyword_meta, children_or_value}

Transformation Strategy

M2.1 (Core Layer)

  • Literals: integers, floats, strings, chars
  • Variables: unqualified and qualified names
  • Binary operators: arithmetic, comparison, boolean
  • Function application
  • Conditionals: if-then-else
  • Lambdas: anonymous functions
  • Let bindings

M2.2 (Extended Layer)

  • List comprehensions
  • Case expressions (pattern matching)
  • Do notation (monadic sequencing)

M2.3 (Native Layer)

  • Type signatures
  • Data type definitions
  • Type class definitions
  • Module definitions

Summary

Functions

Transform Haskell AST to MetaAST.

Functions

transform(unsupported)

@spec transform(term()) :: {:ok, term(), map()} | {:error, String.t()}

Transform Haskell AST to MetaAST.

Returns {:ok, meta_ast, metadata} on success or {:error, reason} on failure.