2e005debc100c8dc442776a37d51dc52771df955
[ghc-hetmet.git] / compiler / coreSyn / ExternalCore.lhs
1 %
2 % (c) The University of Glasgow 2001-2006
3 %
4 \begin{code}
5 {-# OPTIONS -w #-}
6 -- The above warning supression flag is a temporary kludge.
7 -- While working on this module you are encouraged to remove it and fix
8 -- any warnings in the module. See
9 --     http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings
10 -- for details
11
12 module ExternalCore where
13
14
15 data Module 
16  = Module Mname [Tdef] [Vdefg]
17
18 data Tdef 
19   = Data (Qual Tcon) [Tbind] [Cdef]
20   | Newtype (Qual Tcon) [Tbind] (Maybe Ty)
21
22 data Cdef 
23   = Constr Dcon [Tbind] [Ty]
24   | GadtConstr Dcon Ty
25
26 data Vdefg 
27   = Rec [Vdef]
28   | Nonrec Vdef
29
30 type Vdef = (Bool,Var,Ty,Exp)   -- Top level bindings are unqualified now
31
32 data Exp 
33   = Var (Qual Var)
34   | Dcon (Qual Dcon)
35   | Lit Lit
36   | App Exp Exp
37   | Appt Exp Ty
38   | Lam Bind Exp          
39   | Let Vdefg Exp
40   | Case Exp Vbind Ty [Alt] {- non-empty list -}
41   | Cast Exp Ty
42   | Note String Exp
43   | External String String Ty {- target name, convention, and type -} 
44   | DynExternal String Ty {- convention and type (incl. Addr# of target as first arg) -} 
45   | Label String
46
47 data Bind 
48   = Vb Vbind
49   | Tb Tbind
50
51 data Alt 
52   = Acon (Qual Dcon) [Tbind] [Vbind] Exp
53   | Alit Lit Exp
54   | Adefault Exp
55
56 type Vbind = (Var,Ty)
57 type Tbind = (Tvar,Kind)
58
59 data Ty 
60   = Tvar Tvar
61   | Tcon (Qual Tcon)
62   | Tapp Ty Ty
63   | Tforall Tbind Ty 
64
65 data Kind 
66   = Klifted
67   | Kunlifted
68   | Kunboxed
69   | Kopen
70   | Karrow Kind Kind
71   | Keq Ty Ty
72
73 data Lit 
74   = Lint Integer Ty
75   | Lrational Rational Ty
76   | Lchar Char Ty
77   | Lstring String Ty
78   
79
80 type Mname = Id
81 type Var = Id
82 type Tvar = Id
83 type Tcon = Id
84 type Dcon = Id
85
86 type Qual t = (Mname,t)
87
88 type Id = String
89
90 primMname = "base:GHC.Prim"
91
92 tcArrow :: Qual Tcon
93 tcArrow = (primMname, "(->)")
94
95 \end{code}
96
97
98
99