Reorganisation of the source tree
[ghc-hetmet.git] / compiler / coreSyn / ExternalCore.lhs
1 %
2 % (c) The University of Glasgow 2001
3 %
4 \begin{code}
5
6 module ExternalCore where
7
8
9 data Module 
10  = Module Mname [Tdef] [Vdefg]
11
12 data Tdef 
13   = Data (Qual Tcon) [Tbind] [Cdef]
14   | Newtype (Qual Tcon) [Tbind] (Maybe Ty)
15
16 data Cdef 
17   = Constr Dcon [Tbind] [Ty]
18   | GadtConstr Dcon Ty
19
20 data Vdefg 
21   = Rec [Vdef]
22   | Nonrec Vdef
23
24 type Vdef = (Var,Ty,Exp)        -- Top level bindings are unqualified now
25
26 data Exp 
27   = Var (Qual Var)
28   | Dcon (Qual Dcon)
29   | Lit Lit
30   | App Exp Exp
31   | Appt Exp Ty
32   | Lam Bind Exp          
33   | Let Vdefg Exp
34   | Case Exp Vbind Ty [Alt] {- non-empty list -}
35   | Coerce Ty Exp 
36   | Note String Exp
37   | External String Ty
38
39 data Bind 
40   = Vb Vbind
41   | Tb Tbind
42
43 data Alt 
44   = Acon (Qual Dcon) [Tbind] [Vbind] Exp
45   | Alit Lit Exp
46   | Adefault Exp
47
48 type Vbind = (Var,Ty)
49 type Tbind = (Tvar,Kind)
50
51 data Ty 
52   = Tvar Tvar
53   | Tcon (Qual Tcon)
54   | Tapp Ty Ty
55   | Tforall Tbind Ty 
56
57 data Kind 
58   = Klifted
59   | Kunlifted
60   | Kopen
61   | Karrow Kind Kind
62
63 data Lit 
64   = Lint Integer Ty
65   | Lrational Rational Ty
66   | Lchar Char Ty
67   | Lstring String Ty
68   
69
70 type Mname = Id
71 type Var = Id
72 type Tvar = Id
73 type Tcon = Id
74 type Dcon = Id
75
76 type Qual t = (Mname,t)
77
78 type Id = String
79
80 primMname = "GHCziPrim"
81
82 tcArrow :: Qual Tcon
83 tcArrow = (primMname, "ZLzmzgZR")
84
85 \end{code}
86
87
88
89