root/compiler/coreSyn/ExternalCore.lhs

Revision 1df198643cc5502ee103f043193d2990c9837e25, 2.4 KB (checked in by Ian Lynagh <igloo@…>, 7 months ago)

Use -fwarn-tabs when validating

We only use it for "compiler" sources, i.e. not for libraries.
Many modules have a -fno-warn-tabs kludge for now.

  • Property mode set to 100644
Line 
1%
2% (c) The University of Glasgow 2001-2006
3%
4\begin{code}
5{-# OPTIONS -fno-warn-tabs #-}
6-- The above warning supression flag is a temporary kludge.
7-- While working on this module you are encouraged to remove it and
8-- detab the module (please do the detabbing in a separate patch). See
9--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
10-- for details
11
12module ExternalCore where
13
14data Module 
15 = Module Mname [Tdef] [Vdefg]
16
17data Tdef 
18  = Data (Qual Tcon) [Tbind] [Cdef]
19  | Newtype (Qual Tcon) (Qual Tcon) [Tbind] Ty
20
21data Cdef 
22  = Constr (Qual Dcon) [Tbind] [Ty]
23  | GadtConstr (Qual Dcon) Ty
24
25data Vdefg 
26  = Rec [Vdef]
27  | Nonrec Vdef
28
29-- Top-level bindings are qualified, so that the printer doesn't have to pass
30-- around the module name.
31type Vdef = (Bool,Qual Var,Ty,Exp)
32
33data Exp 
34  = Var (Qual Var)
35  | Dcon (Qual Dcon)
36  | Lit Lit
37  | App Exp Exp
38  | Appt Exp Ty
39  | Lam Bind Exp         
40  | Let Vdefg Exp
41  | Case Exp Vbind Ty [Alt] {- non-empty list -}
42  | Cast Exp Ty
43  | Tick String Exp {- XXX probably wrong -}
44  | External String String Ty {- target name, convention, and type -} 
45  | DynExternal String Ty {- convention and type (incl. Addr# of target as first arg) -} 
46  | Label String
47
48data Bind 
49  = Vb Vbind
50  | Tb Tbind
51
52data Alt 
53  = Acon (Qual Dcon) [Tbind] [Vbind] Exp
54  | Alit Lit Exp
55  | Adefault Exp
56
57type Vbind = (Var,Ty)
58type Tbind = (Tvar,Kind)
59
60-- Internally, we represent types and coercions separately; but for
61-- the purposes of external core (at least for now) it's still
62-- convenient to collapse them into a single type.
63data Ty 
64  = Tvar Tvar
65  | Tcon (Qual Tcon)
66  | Tapp Ty Ty
67  | Tforall Tbind Ty 
68-- We distinguish primitive coercions because External Core treats
69-- them specially, so we have to print them out with special syntax.
70  | TransCoercion Ty Ty
71  | SymCoercion Ty
72  | UnsafeCoercion Ty Ty
73  | InstCoercion Ty Ty
74  | NthCoercion Int Ty
75
76data Kind 
77  = Klifted
78  | Kunlifted
79  | Kunboxed
80  | Kopen
81  | Karrow Kind Kind
82 
83data Lit 
84  = Lint Integer Ty
85  | Lrational Rational Ty
86  | Lchar Char Ty
87  | Lstring String Ty
88 
89
90type Mname = Id
91type Var = Id
92type Tvar = Id
93type Tcon = Id
94type Dcon = Id
95
96type Qual t = (Mname,t)
97
98type Id = String
99
100primMname :: Mname
101-- For truly horrible reasons, this must be z-encoded.
102-- With any hope, the z-encoding will die soon.
103primMname = "ghczmprim:GHCziPrim"
104
105tcArrow :: Qual Tcon
106tcArrow = (primMname, "(->)")
107
108\end{code}
109
110
111
Note: See TracBrowser for help on using the browser.