Fix external core syntax (though not full compilation)
[ghc-hetmet.git] / compiler / coreSyn / ExternalCore.lhs
1 %
2 % (c) The University of Glasgow 2001-2006
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 = (Bool,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   | Cast Exp Ty
36   | Note String Exp
37   | External String String Ty {- target name, convention, and type -} 
38   | DynExternal String Ty {- convention and type (incl. Addr# of target as first arg) -} 
39   | Label String
40
41 data Bind 
42   = Vb Vbind
43   | Tb Tbind
44
45 data Alt 
46   = Acon (Qual Dcon) [Tbind] [Vbind] Exp
47   | Alit Lit Exp
48   | Adefault Exp
49
50 type Vbind = (Var,Ty)
51 type Tbind = (Tvar,Kind)
52
53 data Ty 
54   = Tvar Tvar
55   | Tcon (Qual Tcon)
56   | Tapp Ty Ty
57   | Tforall Tbind Ty 
58
59 data Kind 
60   = Klifted
61   | Kunlifted
62   | Kunboxed
63   | Kopen
64   | Karrow Kind Kind
65   | Keq Ty Ty
66
67 data Lit 
68   = Lint Integer Ty
69   | Lrational Rational Ty
70   | Lchar Char Ty
71   | Lstring String Ty
72   
73
74 type Mname = Id
75 type Var = Id
76 type Tvar = Id
77 type Tcon = Id
78 type Dcon = Id
79
80 type Qual t = (Mname,t)
81
82 type Id = String
83
84 primMname = "base:GHC.Prim"
85
86 tcArrow :: Qual Tcon
87 tcArrow = (primMname, "(->)")
88
89 \end{code}
90
91
92
93