2 % (c) The University of Glasgow 2001-2006
5 module ExternalCore where
8 = Module Mname [Tdef] [Vdefg]
11 = Data (Qual Tcon) [Tbind] [Cdef]
12 | Newtype (Qual Tcon) (Qual Tcon) [Tbind] Ty
15 = Constr (Qual Dcon) [Tbind] [Ty]
16 | GadtConstr (Qual Dcon) Ty
22 -- Top-level bindings are qualified, so that the printer doesn't have to pass
23 -- around the module name.
24 type Vdef = (Bool,Qual Var,Ty,Exp)
34 | Case Exp Vbind Ty [Alt] {- non-empty list -}
37 | External String String Ty {- target name, convention, and type -}
38 | DynExternal String Ty {- convention and type (incl. Addr# of target as first arg) -}
46 = Acon (Qual Dcon) [Tbind] [Vbind] Exp
51 type Tbind = (Tvar,Kind)
53 -- Internally, we represent types and coercions separately; but for
54 -- the purposes of external core (at least for now) it's still
55 -- convenient to collapse them into a single type.
61 -- We distinguish primitive coercions because External Core treats
62 -- them specially, so we have to print them out with special syntax.
65 | UnsafeCoercion Ty Ty
79 | Lrational Rational Ty
90 type Qual t = (Mname,t)
95 -- For truly horrible reasons, this must be z-encoded.
96 -- With any hope, the z-encoding will die soon.
97 primMname = "ghczmprim:GHCziPrim"
100 tcArrow = (primMname, "(->)")