blob: 8326440e8529b26ef3a8cbfeb20b57de7f0475f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
module Haskell.AST where
type Name = String
type TyVar = String
data AST = AST [Toplevel]
deriving (Show)
data Toplevel = TopDef Def
| TopDecl Decl
| TopData Data
| TopClass Class
| TopInst Inst
deriving (Show)
data Def = Def Name Expr
deriving (Show)
data Expr = App Expr [Expr]
| Ref Name
| LitNum Integer
| Tup [Expr]
| Lam [Name] Expr
| Case Name [(Pat, Expr)]
deriving (Show)
data Pat = PatAny
| PatVar Name
| PatCon Name [Pat]
| PatTup [Pat]
deriving (Show)
data Decl = Decl Name Type
deriving (Show)
data Type = TyTup [Type]
| TyInt
| TyFun Type Type
| TyRef Name [Type]
| TyVar Name
| TyVoid
deriving (Show)
data Data = Data Name [TyVar] [(Name, [Type])]
deriving (Show)
data Class = Class Name [TyVar] [Decl]
deriving (Show)
data Inst = Inst Name Type [Def]
deriving (Show)
|