ast

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compact

func Compact(node Node) string

Compact returns a compact single-line JSON representation

func EffectNames

func EffectNames(effects []EffectAnnotation) []string

EffectNames extracts just the effect names from annotations (for backward compatibility)

func FormatEffects

func FormatEffects(effects []EffectAnnotation) string

FormatEffects formats a slice of effect annotations for display

func Print

func Print(node Node) string

Print produces a deterministic JSON representation of an AST node. This is used for golden snapshot testing.

Design decisions: - Omits instance-specific metadata: SIDs, byte offsets, detailed positions - Normalizes file paths to "test://unit" for reproducibility - Includes "type" field for each node to identify node type - Uses JSON marshaling with custom handling for Node interface

func PrintProgram

func PrintProgram(prog *Program) string

PrintProgram produces a deterministic JSON representation of a Program. Note: Program doesn't implement Node, so we handle it separately.

Types

type AlgebraicType

type AlgebraicType struct {
	Constructors []*Constructor
	Pos          Pos
}

AlgebraicType represents sum types

type Annotation

type Annotation struct {
	Name string // e.g., "route", "verify"
	Args []Expr // Positional arguments (string literals, int literals, etc.)
	Pos  Pos
}

Annotation represents a parsed @name(...) annotation on a declaration.

type Array

type Array struct {
	Elements []Expr
	Pos      Pos
}

Array represents an array literal #[1, 2, 3] Arrays provide O(1) indexed access unlike linked lists

func (*Array) Position

func (a *Array) Position() Pos

func (*Array) String

func (a *Array) String() string

type ArrayType

type ArrayType struct {
	Element Type
	Pos     Pos
}

ArrayType represents array types Array[T]

func (*ArrayType) Position

func (a *ArrayType) Position() Pos

func (*ArrayType) String

func (a *ArrayType) String() string

type AssertStmt

type AssertStmt struct {
	Condition Expr
	Message   string // Optional failure message
	Pos       Pos
}

AssertStmt represents an assertion: assert expr

func (*AssertStmt) Position

func (a *AssertStmt) Position() Pos

func (*AssertStmt) String

func (a *AssertStmt) String() string

type BinaryOp

type BinaryOp struct {
	Left  Expr
	Op    string
	Right Expr
	Pos   Pos
}

BinaryOp represents a binary operation

func (*BinaryOp) Position

func (b *BinaryOp) Position() Pos

func (*BinaryOp) String

func (b *BinaryOp) String() string

type Binder

type Binder struct {
	Name string
	Type Type
	Pos  Pos
}

type Block

type Block struct {
	Exprs []Expr
	Pos   Pos
}

Block represents a sequence of expressions separated by semicolons The last expression is the return value, others are evaluated for effects

func (*Block) Position

func (b *Block) Position() Pos

func (*Block) String

func (b *Block) String() string

type Case

type Case struct {
	Pattern Pattern
	Guard   Expr // Optional guard clause
	Body    Expr
	Pos     Pos
}

type ConsPattern

type ConsPattern struct {
	Head Pattern
	Tail Pattern
	Pos  Pos
}

ConsPattern matches list cons

func (*ConsPattern) Position

func (c *ConsPattern) Position() Pos

func (*ConsPattern) String

func (c *ConsPattern) String() string

type Constructor

type Constructor struct {
	Name   string
	Fields []*ConstructorField
	Pos    Pos
}

type ConstructorField

type ConstructorField struct {
	Name string // Field name (empty for positional fields)
	Type Type   // Field type
	Pos  Pos
}

ConstructorField represents a field in an ADT constructor. Supports both named fields (x: int) and positional fields (int).

type ConstructorPattern

type ConstructorPattern struct {
	Name     string
	Patterns []Pattern
	Pos      Pos
}

ConstructorPattern matches algebraic type constructors

func (*ConstructorPattern) Position

func (c *ConstructorPattern) Position() Pos

func (*ConstructorPattern) String

func (c *ConstructorPattern) String() string

type ContractKind

type ContractKind int

ContractKind distinguishes between property tests and contract clauses. This enables reuse of the Property struct for both forall-style tests and requires/ensures contracts (M-VERIFY).

const (
	PropertyKind  ContractKind = iota // Existing forall property-based tests
	RequiresKind                      // Precondition contract
	EnsuresKind                       // Postcondition contract
	InvariantKind                     // Type/module invariant contract
)

func (ContractKind) String

func (k ContractKind) String() string

String returns the string representation of a ContractKind

type DeriveKind

type DeriveKind int

DeriveKind represents which type classes can be automatically derived

const (
	DeriveNone DeriveKind = iota
	DeriveEq              // deriving (Eq) - automatic equality

)

func (DeriveKind) String

func (d DeriveKind) String() string

String returns the string representation of a DeriveKind

type EffectAnnotation

type EffectAnnotation struct {
	Name     string // Effect name (e.g., "IO", "FS", "Net") or row variable (e.g., "e")
	IsRowVar bool   // True if this is an effect row variable (lowercase identifier)
	Budget   *int   // Optional budget limit / max (nil = unlimited)
	Min      *int   // Optional minimum usage requirement (nil = no minimum) (M-DX25 M4)
	Pos      Pos
}

EffectAnnotation represents an effect with optional budget constraints Syntax: IO or IO @limit=5 or IO @min=1 or IO @min=1 @limit=5 Row variables: lowercase identifiers like 'e' in ! {e} for effect polymorphism

func (*EffectAnnotation) String

func (e *EffectAnnotation) String() string

String formats the effect annotation for display

type Error

type Error struct {
	Pos Pos
	Msg string
}

Error represents a parse error node (placeholder for error recovery)

func (*Error) Literal

func (e *Error) Literal() string

func (*Error) Position

func (e *Error) Position() Pos

func (*Error) String

func (e *Error) String() string

type Expr

type Expr interface {
	Node
	// contains filtered or unexported methods
}

Expression nodes

type Field

type Field struct {
	Name  string
	Value Expr
	Pos   Pos
}

type FieldPattern

type FieldPattern struct {
	Name    string
	Pattern Pattern
	Pos     Pos
}

type File

type File struct {
	Module     *ModuleDecl   // Optional module declaration
	Imports    []*ImportDecl // Import declarations
	Decls      []Node        // Top-level declarations (deprecated, use Funcs/Statements)
	Funcs      []*FuncDecl   // Function declarations
	Statements []Node        // Top-level statements/expressions
	Path       string        // File path for validation
	Pos        Pos
}

File represents a complete AILANG source file

func (*File) Position

func (f *File) Position() Pos

func (*File) String

func (f *File) String() string

type ForallExpr

type ForallExpr struct {
	Var  string // Bound variable name
	Lo   Expr   // Lower bound (inclusive)
	Hi   Expr   // Upper bound (exclusive)
	Body Expr   // Quantified body (boolean predicate)
	Pos  Pos
}

ForallExpr represents a bounded universal quantifier: forall i: lo..hi => body Used in contract clauses (requires/ensures) for element-wise properties. Only integer quantifiers are supported.

func (*ForallExpr) Position

func (f *ForallExpr) Position() Pos

func (*ForallExpr) String

func (f *ForallExpr) String() string

type FuncCall

type FuncCall struct {
	Func Expr
	Args []Expr
	Pos  Pos
}

FuncCall represents a function application.

Usage example:

call := &ast.FuncCall{
    Func: &ast.Identifier{Name: "factorial", Pos: pos},
    Args: []ast.Expr{
        &ast.Literal{Kind: ast.IntLit, Value: int64(5), Pos: pos},
    },
    Pos: p.curToken.Pos,
}

Common parser pattern:

// Parse: factorial(5)
func := p.parseExpression(CALL) // parses "factorial"
p.nextToken() // move to LPAREN
args := p.parseCallArguments() // parses "(5)"
return &ast.FuncCall{Func: func, Args: args, Pos: startPos}

func (*FuncCall) Position

func (f *FuncCall) Position() Pos

func (*FuncCall) String

func (f *FuncCall) String() string

type FuncDecl

type FuncDecl struct {
	Name        string
	TypeParams  []string // Generic type parameters
	Params      []*Param
	ReturnType  Type
	Effects     []EffectAnnotation // Effect annotations with optional budgets
	Tests       []*TestCase
	Properties  []*Property
	Body        Expr // nil for extern functions
	IsPure      bool
	IsExport    bool          // Export flag
	IsExtern    bool          // Extern flag - function implemented in Go, no body
	VerifyDepth *int          // Per-function SMT verification depth override (nil = use global default)
	Annotations []*Annotation // Generic annotations (e.g., @route, @verify)
	Pos         Pos
	Span        Span   // For SID calculation
	SID         string // Stable ID (calculated post-parse)
	Origin      string // "func_decl" for metadata
}

FuncDecl represents a function declaration.

Usage example:

funcDecl := &ast.FuncDecl{
    Name:       "factorial",
    TypeParams: []string{},
    Params: []*ast.Param{
        {Name: "n", Type: intType, Pos: pos},
    },
    ReturnType: intType,
    Effects:    []EffectAnnotation{},
    Tests:      []*ast.TestCase{},
    Properties: []*ast.Property{},
    Body:       bodyExpr,
    IsPure:     true,
    IsExport:   false,
    Pos:        p.curToken.Pos,
}

Common parser pattern:

// Parse: func factorial(n: int) -> int { ... }
p.nextToken() // skip "func"
name := p.curToken.Literal
p.nextToken() // move to LPAREN
params := p.parseFunctionParams()
returnType := p.parseReturnType()
effects := p.parseEffects()
body := p.parseExpression(LOWEST)
return &ast.FuncDecl{
    Name: name, Params: params,
    ReturnType: returnType, Effects: effects,
    Body: body, Pos: startPos,
}

func (*FuncDecl) GetAnnotation

func (f *FuncDecl) GetAnnotation(name string) *Annotation

GetAnnotation returns the first annotation with the given name, or nil.

func (*FuncDecl) Position

func (f *FuncDecl) Position() Pos

func (*FuncDecl) String

func (f *FuncDecl) String() string

type FuncLit

type FuncLit struct {
	Params     []*Param
	ReturnType Type               // Optional return type annotation
	Effects    []EffectAnnotation // Effect annotations with optional budgets
	Body       Expr
	Pos        Pos
}

FuncLit represents an anonymous function literal (func expression) Syntax: func(x: int, y: int) -> int { x + y } This desugars to Lambda in the elaboration phase

func (*FuncLit) Position

func (f *FuncLit) Position() Pos

func (*FuncLit) String

func (f *FuncLit) String() string

type FuncType

type FuncType struct {
	Params  []Type
	Return  Type
	Effects []EffectAnnotation // Effect annotations with optional budgets
	Pos     Pos
}

FuncType represents function types

func (*FuncType) Position

func (f *FuncType) Position() Pos

func (*FuncType) String

func (f *FuncType) String() string

type Identifier

type Identifier struct {
	Name string
	Pos  Pos
}

Identifier represents a variable or function name.

Usage example:

ident := &ast.Identifier{
    Name: "factorial",
    Pos:  p.curToken.Pos,
}

Common pattern in parser:

if p.curTokenIs(lexer.IDENT) {
    return &ast.Identifier{Name: p.curToken.Literal, Pos: p.curToken.Pos}
}

Type assertions:

ident, ok := expr.(*ast.Identifier)
if ok {
    fmt.Println("Variable name:", ident.Name)
}

func (*Identifier) Position

func (i *Identifier) Position() Pos

func (*Identifier) String

func (i *Identifier) String() string

type If

type If struct {
	Condition Expr
	Then      Expr
	Else      Expr
	Pos       Pos
}

If represents a conditional expression

func (*If) Position

func (i *If) Position() Pos

func (*If) String

func (i *If) String() string

type Import

type Import struct {
	Path         string
	Alias        string
	Symbols      []string // Specific imports
	Capabilities []string // Capability imports
	Pos          Pos
}

type ImportDecl

type ImportDecl struct {
	Path          string            // Module path to import
	Symbols       []string          // Selective imports (empty = whole module)
	ModuleAlias   string            // Module alias: "import std/list as List" -> "List"
	SymbolAliases map[string]string // Symbol aliases: original -> alias (e.g., "length" -> "stringLength")
	IsPackage     bool              // True if import uses pkg/ prefix (external package)
	PackageName   string            // Package name (vendor/name) extracted from pkg/ import path
	IsRelative    bool              // True if import uses ./ prefix (intra-package sibling)
	RelativePath  string            // Relative portion after ./ (e.g., "plan" from "./plan")
	Pos           Pos
	Span          Span
}

ImportDecl represents an import declaration

func (*ImportDecl) Position

func (i *ImportDecl) Position() Pos

func (*ImportDecl) String

func (i *ImportDecl) String() string

type Instance

type Instance struct {
	ClassName string
	Type      Type
	Methods   map[string]Expr
	Pos       Pos
}

Instance represents a type class instance

func (*Instance) Position

func (i *Instance) Position() Pos

func (*Instance) String

func (i *Instance) String() string

type Interpolation

type Interpolation struct {
	Name string
	Expr Expr
	Type Type // Optional type annotation
	Pos  Pos
}

type Lambda

type Lambda struct {
	Params  []*Param
	Body    Expr
	Effects []EffectAnnotation // Effect annotations with optional budgets
	Pos     Pos
}

Lambda represents a lambda expression.

Usage example:

lambda := &ast.Lambda{
    Params: []*ast.Param{
        {Name: "x", Type: nil, Pos: pos1},
        {Name: "y", Type: nil, Pos: pos2},
    },
    Body:    bodyExpr,
    Effects: []EffectAnnotation{{Name: "IO"}},
    Pos:     p.curToken.Pos,
}

Common parser pattern:

// Parse: \x y. x + y
p.nextToken() // skip \
params := p.parseParams()
p.expectToken(lexer.DOT)
body := p.parseExpression(LOWEST)
return &ast.Lambda{Params: params, Body: body, Pos: startPos}

func (*Lambda) Position

func (l *Lambda) Position() Pos

func (*Lambda) String

func (l *Lambda) String() string

type Let

type Let struct {
	Name  string
	Type  Type // Optional type annotation
	Value Expr
	Body  Expr
	Pos   Pos
}

Let represents a let binding

func (*Let) Position

func (l *Let) Position() Pos

func (*Let) String

func (l *Let) String() string

type LetRec

type LetRec struct {
	Name  string
	Type  Type // Optional type annotation
	Value Expr
	Body  Expr
	Pos   Pos
}

LetRec represents a recursive let binding Syntax: letrec name = value in body The name is in scope in the value expression (for recursion)

func (*LetRec) Position

func (l *LetRec) Position() Pos

func (*LetRec) String

func (l *LetRec) String() string

type List

type List struct {
	Elements []Expr
	Pos      Pos
}

List represents a list literal.

Usage example:

list := &ast.List{
    Elements: []ast.Expr{
        &ast.Literal{Kind: ast.IntLit, Value: int64(1), Pos: pos},
        &ast.Literal{Kind: ast.IntLit, Value: int64(2), Pos: pos},
        &ast.Literal{Kind: ast.IntLit, Value: int64(3), Pos: pos},
    },
    Pos: p.curToken.Pos,
}

Common parser pattern:

// Parse: [1, 2, 3]
p.nextToken() // skip [
elements := []ast.Expr{}
for !p.curTokenIs(lexer.RBRACKET) {
    elements = append(elements, p.parseExpression(LOWEST))
    if p.peekTokenIs(lexer.COMMA) {
        p.nextToken() // move to comma
        p.nextToken() // move past comma
    }
}
p.nextToken() // skip ]
return &ast.List{Elements: elements, Pos: startPos}

func (*List) Position

func (l *List) Position() Pos

func (*List) String

func (l *List) String() string

type ListPattern

type ListPattern struct {
	Elements []Pattern
	Rest     Pattern // Optional rest pattern
	Pos      Pos
}

ListPattern matches list literals

func (*ListPattern) Position

func (l *ListPattern) Position() Pos

func (*ListPattern) String

func (l *ListPattern) String() string

type ListType

type ListType struct {
	Element Type
	Pos     Pos
}

ListType represents list types

func (*ListType) Position

func (l *ListType) Position() Pos

func (*ListType) String

func (l *ListType) String() string

type Literal

type Literal struct {
	Kind  LiteralKind
	Value interface{}
	Pos   Pos
}

Literal represents a literal value.

⚠️ CRITICAL GOTCHA: Lexer returns int64 for integers, NOT int!

Usage example:

lit := &ast.Literal{
    Kind:  ast.IntLit,
    Value: int64(42),  // ⚠️ Must be int64, not int!
    Pos:   p.curToken.Pos,
}

Type assertions (CORRECT):

lit := expr.(*ast.Literal)
if lit.Kind == ast.IntLit {
    val := lit.Value.(int64)  // ✅ CORRECT - int64
    fmt.Println("Integer:", val)
}

Type assertions (WRONG):

val := lit.Value.(int)  // ❌ WRONG - will panic! Lexer returns int64

Common parser pattern:

case lexer.INT:
    val, _ := strconv.ParseInt(p.curToken.Literal, 10, 64)
    return &ast.Literal{Kind: ast.IntLit, Value: val, Pos: p.curToken.Pos}

func (*Literal) Position

func (l *Literal) Position() Pos

func (*Literal) String

func (l *Literal) String() string

type LiteralKind

type LiteralKind int
const (
	IntLit LiteralKind = iota
	FloatLit
	StringLit
	BoolLit
	UnitLit
)

type Match

type Match struct {
	Expr  Expr
	Cases []*Case
	Pos   Pos
}

Match represents pattern matching

func (*Match) Position

func (m *Match) Position() Pos

func (*Match) String

func (m *Match) String() string

type Method

type Method struct {
	Name    string
	Type    Type
	Default Expr // Optional default implementation
	Pos     Pos
}

type Module

type Module struct {
	Name    string
	Imports []*Import
	Exports []string
	Decls   []Node
	Pos     Pos
}

Module represents a module

func (*Module) Position

func (m *Module) Position() Pos

func (*Module) String

func (m *Module) String() string

type ModuleDecl

type ModuleDecl struct {
	Path string // e.g., "foo/bar"
	Pos  Pos
	Span Span // For SID calculation
}

ModuleDecl represents a module declaration

func (*ModuleDecl) Position

func (m *ModuleDecl) Position() Pos

func (*ModuleDecl) String

func (m *ModuleDecl) String() string

type Node

type Node interface {
	String() string
	Position() Pos
}

Node is the base interface for all AST nodes

type Param

type Param struct {
	Name string
	Type Type
	Pos  Pos
}

type Pattern

type Pattern interface {
	Node
	// contains filtered or unexported methods
}

Pattern nodes for pattern matching

type Pos

type Pos struct {
	Line   int
	Column int
	File   string
	Offset int // Byte offset for SID calculation
}

Pos represents a position in the source code

func (Pos) String

func (p Pos) String() string

type Program

type Program struct {
	File   *File   // New: Use File instead of Module
	Module *Module // Legacy: Keep for compatibility
}

Program represents the entire program

func (*Program) String

func (p *Program) String() string

type Property

type Property struct {
	Name    string
	Kind    ContractKind // Type of property/contract (M-VERIFY)
	Binders []*Binder    // forall bindings (empty for requires/ensures)
	Expr    Expr         // Boolean predicate
	Pos     Pos
}

type PropertyDecl

type PropertyDecl struct {
	Name     string
	Property *Property // The property specification
	Pos      Pos
}

PropertyDecl represents a top-level property block: property "name" { forall(...) => expr }

func (*PropertyDecl) Position

func (p *PropertyDecl) Position() Pos

func (*PropertyDecl) String

func (p *PropertyDecl) String() string

type QuasiQuote

type QuasiQuote struct {
	Kind           string // sql, html, regex, json, shell, url
	Template       string
	Interpolations []*Interpolation
	Pos            Pos
}

QuasiQuote represents typed quasiquotes

func (*QuasiQuote) Position

func (q *QuasiQuote) Position() Pos

func (*QuasiQuote) String

func (q *QuasiQuote) String() string

type Record

type Record struct {
	Fields []*Field
	Pos    Pos
}

Record represents a record literal

func (*Record) Position

func (r *Record) Position() Pos

func (*Record) String

func (r *Record) String() string

type RecordAccess

type RecordAccess struct {
	Record Expr
	Field  string
	Pos    Pos
}

RecordAccess represents field access

func (*RecordAccess) Position

func (r *RecordAccess) Position() Pos

func (*RecordAccess) String

func (r *RecordAccess) String() string

type RecordField

type RecordField struct {
	Name string
	Type Type
	Pos  Pos
}

type RecordPattern

type RecordPattern struct {
	Fields []*FieldPattern
	Rest   bool // Has rest pattern ...
	Pos    Pos
}

RecordPattern matches records

func (*RecordPattern) Position

func (r *RecordPattern) Position() Pos

func (*RecordPattern) String

func (r *RecordPattern) String() string

type RecordType

type RecordType struct {
	Fields []*RecordField
	Row    *TypeVar // Row variable for open records (e.g., {a: T | r})
	Pos    Pos
}

RecordType represents record types If Row is non-nil, this is an open record type {a: T | r}

func (*RecordType) Position

func (r *RecordType) Position() Pos

func (*RecordType) String

func (r *RecordType) String() string

type RecordUpdate

type RecordUpdate struct {
	Base   Expr     // The base record expression
	Fields []*Field // Fields to update
	Pos    Pos
}

RecordUpdate represents functional record update: {base | field: value, ...}

func (*RecordUpdate) Position

func (r *RecordUpdate) Position() Pos

func (*RecordUpdate) String

func (r *RecordUpdate) String() string

type Recv

type Recv struct {
	Channel Expr
	Pos     Pos
}

func (*Recv) Position

func (r *Recv) Position() Pos

func (*Recv) String

func (r *Recv) String() string

type Send

type Send struct {
	Channel Expr
	Value   Expr
	Pos     Pos
}

Channel operations

func (*Send) Position

func (s *Send) Position() Pos

func (*Send) String

func (s *Send) String() string

type SimpleType

type SimpleType struct {
	Name string
	Pos  Pos
}

SimpleType represents basic types

func (*SimpleType) Position

func (s *SimpleType) Position() Pos

func (*SimpleType) String

func (s *SimpleType) String() string

type Span

type Span struct {
	Start Pos
	End   Pos
}

Span represents a range in source code

type Stmt

type Stmt interface {
	Node
	// contains filtered or unexported methods
}

Statement nodes (though AILANG is expression-based)

type TestCase

type TestCase struct {
	Inputs   []Expr // Multiple inputs for multi-arg functions
	Expected Expr   // Expected output
	Pos      Pos
}

type TestDecl

type TestDecl struct {
	Name string
	Body []Expr // Test body (assertions, expressions)
	Pos  Pos
}

TestDecl represents a top-level test block: test "name" { ... }

func (*TestDecl) Position

func (t *TestDecl) Position() Pos

func (*TestDecl) String

func (t *TestDecl) String() string

type Tuple

type Tuple struct {
	Elements []Expr
	Pos      Pos
}

Tuple represents a tuple

func (*Tuple) Position

func (t *Tuple) Position() Pos

func (*Tuple) String

func (t *Tuple) String() string

type TuplePattern

type TuplePattern struct {
	Elements []Pattern
	Pos      Pos
}

TuplePattern matches tuples

func (*TuplePattern) Position

func (t *TuplePattern) Position() Pos

func (*TuplePattern) String

func (t *TuplePattern) String() string

type TupleType

type TupleType struct {
	Elements []Type
	Pos      Pos
}

TupleType represents tuple types

func (*TupleType) Position

func (t *TupleType) Position() Pos

func (*TupleType) String

func (t *TupleType) String() string

type Type

type Type interface {
	Node
	// contains filtered or unexported methods
}

Type nodes

type TypeAlias

type TypeAlias struct {
	Target Type // The aliased type expression
	Pos    Pos
}

TypeAlias represents type aliases (not sum types) Used to distinguish `type Names = [string]` from `type Color = Red | Green`

type TypeApp

type TypeApp struct {
	Constructor string // Type constructor name (e.g., "Option", "Result")
	Args        []Type // Type arguments (e.g., [int], [T, E])
	Pos         Pos
}

TypeApp represents type application (generic types) Example: Option[int], Result[T, E], Map[string, int] M-TAPP-FIX: Added to preserve type arguments in annotations

func (*TypeApp) Position

func (t *TypeApp) Position() Pos

func (*TypeApp) String

func (t *TypeApp) String() string

type TypeClass

type TypeClass struct {
	Name       string
	TypeParam  string
	Superclass string // Optional superclass
	Methods    []*Method
	Pos        Pos
}

TypeClass represents a type class declaration

func (*TypeClass) Position

func (t *TypeClass) Position() Pos

func (*TypeClass) String

func (t *TypeClass) String() string

type TypeDecl

type TypeDecl struct {
	Name       string
	TypeParams []string
	Definition TypeDef
	Deriving   []DeriveKind // Type classes to auto-derive (e.g., [DeriveEq])
	Exported   bool         // True if type was declared with 'export'
	Pos        Pos
}

TypeDecl represents a type declaration

func (*TypeDecl) Position

func (t *TypeDecl) Position() Pos

func (*TypeDecl) String

func (t *TypeDecl) String() string

type TypeDef

type TypeDef interface {
	// contains filtered or unexported methods
}

type TypeVar

type TypeVar struct {
	Name string
	Pos  Pos
}

TypeVar represents type variables

func (*TypeVar) Position

func (t *TypeVar) Position() Pos

func (*TypeVar) String

func (t *TypeVar) String() string

type UnaryOp

type UnaryOp struct {
	Op   string
	Expr Expr
	Pos  Pos
}

UnaryOp represents a unary operation

func (*UnaryOp) Position

func (u *UnaryOp) Position() Pos

func (*UnaryOp) String

func (u *UnaryOp) String() string

type WildcardPattern

type WildcardPattern struct {
	Pos Pos
}

WildcardPattern matches anything

func (*WildcardPattern) Position

func (w *WildcardPattern) Position() Pos

func (*WildcardPattern) String

func (w *WildcardPattern) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL