[project @ 1996-01-18 16:33:17 by partain]
[ghc-hetmet.git] / ghc / lib / prelude / TysBasic.hs
1 module PreludeBuiltin (
2         Char(..),
3         Int(..),
4         _Word(..),
5         _Addr(..),
6         Float(..),
7         Double(..),
8         _State(..),
9         _MallocPtr(..),
10         Integer(..),
11         _Return2GMPs(..),
12         _ReturnIntAndGMP(..),
13         StateAndPtr#(..),
14         StateAndChar#(..),
15         StateAndInt#(..),
16         StateAndWord#(..),
17         StateAndFloat#(..),
18         StateAndDouble#(..),
19         StateAndAddr#(..),
20         StateAndMallocPtr#(..),
21         StateAndArray#(..),
22         StateAndMutableArray#(..),
23         StateAndByteArray#(..),
24         StateAndMutableByteArray#(..),
25         StateAndSynchVar#(..),
26 #ifndef __PARALLEL_HASKELL__
27         _StablePtr(..),
28         StateAndStablePtr#(..),
29 #endif
30         _CMP_TAG(..),
31         List(..),
32         Tuple0(..),
33         Tuple2(..),
34         Tuple3(..),
35         Tuple4(..),
36         Tuple5(..),
37         Tuple6(..),
38         Tuple7(..),
39         Tuple8(..),
40         Tuple9(..),
41         Tuple10(..),
42         Tuple11(..),
43         Tuple12(..),
44         Tuple13(..),
45         Tuple14(..),
46         Tuple15(..),
47         Tuple16(..),
48         Tuple17(..),
49         Tuple18(..),
50         Tuple19(..),
51         Tuple20(..),
52         Tuple21(..),
53         Tuple22(..),
54         Tuple23(..),
55         Tuple24(..),
56         Tuple25(..),
57         Tuple26(..),
58         Tuple27(..),
59         Tuple28(..),
60         Tuple29(..),
61         Tuple30(..),
62         Tuple31(..),
63         Tuple32(..),
64         Bin(..),
65         _Lift(..)
66     ) where
67
68 -- *********
69 -- This follows the organisation of compiler/prelude/TysWiredIn.lhs
70 -- (which follows the state-interface.verb document).
71 -- *********
72
73 -- instances are all done carefully, by hand (in the prelude/I*.hs files)
74
75 ----------------------------------------------------
76
77 data Char   = C# Char#
78 data Int    = I# Int#
79 data _Word  = W# Word#
80 data _Addr  = A# Addr#
81 data Float  = F# Float#
82 data Double = D# Double#
83
84 data _State a = S# (State# a)
85
86 ----------------------------------------------------
87
88 -- Array is from PreludeArray & so can't be defined here.
89 -- _ByteArray, _MutableArray & _MutableByteArray are from PreludeGlaArray ...
90
91 data _MallocPtr = _MallocPtr MallocPtr#
92 #ifndef __PARALLEL_HASKELL__
93 data _StablePtr a = _StablePtr (StablePtr# a)
94 #endif
95
96 ----------------------------------------------------
97
98 data Integer = J# Int# Int# ByteArray#
99         -- corresponds to GNU multi-prec arith pkg rep
100
101 -- Old:
102 --   Oddly enough, the Return<blah>GMP<blah> don't need definitions,
103 --   because they are only used in "returning" (and so are never
104 --   actually built).
105 -- New:
106 --   Unless you want to write your own code using the Integer primops
107 --   -- at which point it becomes essential to have these types. ADR
108
109 data _Return2GMPs = _Return2GMPs Int# Int# ByteArray# Int# Int# ByteArray#
110 data _ReturnIntAndGMP = _ReturnIntAndGMP Int# Int# Int# ByteArray#
111
112 ----------------------------------------------------
113
114 data StateAndPtr#    s elt = StateAndPtr#    (State# s) elt 
115
116 data StateAndChar#   s     = StateAndChar#   (State# s) Char# 
117 data StateAndInt#    s     = StateAndInt#    (State# s) Int# 
118 data StateAndWord#   s     = StateAndWord#   (State# s) Word#
119 data StateAndFloat#  s     = StateAndFloat#  (State# s) Float# 
120 data StateAndDouble# s     = StateAndDouble# (State# s) Double#  
121 data StateAndAddr#   s     = StateAndAddr#   (State# s) Addr#
122
123 #ifndef __PARALLEL_HASKELL__
124 data StateAndStablePtr# s a = StateAndStablePtr# (State# s) (StablePtr# a)
125 #endif
126 data StateAndMallocPtr# s   = StateAndMallocPtr# (State# s) MallocPtr#
127
128 data StateAndArray#            s elt = StateAndArray#        (State# s) (Array# elt) 
129 data StateAndMutableArray#     s elt = StateAndMutableArray# (State# s) (MutableArray# s elt)  
130 data StateAndByteArray#        s = StateAndByteArray#        (State# s) ByteArray# 
131 data StateAndMutableByteArray# s = StateAndMutableByteArray# (State# s) (MutableByteArray# s)
132
133 data StateAndSynchVar# s elt = StateAndSynchVar# (State# s) (SynchVar# s elt)
134
135 ----------------------------------------------------
136 -- Bool: is from PreludeCore
137
138 data _CMP_TAG = _LT | _EQ | _GT -- for derived comparisons
139
140 ----------------------------------------------------
141
142 data List a = Nil | a : (List a)
143 {-# GENERATE_SPECS data a :: List a #-}
144
145 ----------------------------------------------------
146
147 data Tuple0                                  = Tup0
148 data Tuple2  a b                             = Tup2  a b
149 data Tuple3  a b c                           = Tup3  a b c
150 data Tuple4  a b c d                         = Tup4  a b c d
151 data Tuple5  a b c d e                       = Tup5  a b c d e
152 data Tuple6  a b c d e f                     = Tup6  a b c d e f
153 data Tuple7  a b c d e f g                   = Tup7  a b c d e f g
154 data Tuple8  a b c d e f g h                 = Tup8  a b c d e f g h
155 data Tuple9  a b c d e f g h i               = Tup9  a b c d e f g h i
156 data Tuple10 a b c d e f g h i j             = Tup10 a b c d e f g h i j
157 data Tuple11 a b c d e f g h i j k           = Tup11 a b c d e f g h i j k
158 data Tuple12 a b c d e f g h i j k l         = Tup12 a b c d e f g h i j k l
159 data Tuple13 a b c d e f g h i j k l m       = Tup13 a b c d e f g h i j k l m
160 data Tuple14 a b c d e f g h i j k l m n     = Tup14 a b c d e f g h i j k l m n
161 data Tuple15 a b c d e f g h i j k l m n o   = Tup15 a b c d e f g h i j k l m n o
162 data Tuple16 a b c d e f g h i j k l m n o p = Tup16 a b c d e f g h i j k l m n o p
163 data Tuple17 a b c d e f g h i j k l m n o p q
164  = Tup17 a b c d e f g h i j k l m n o p q
165 data Tuple18 a b c d e f g h i j k l m n o p q r
166  = Tup18 a b c d e f g h i j k l m n o p q r
167 data Tuple19 a b c d e f g h i j k l m n o p q r s
168  = Tup19 a b c d e f g h i j k l m n o p q r s
169 data Tuple20 a b c d e f g h i j k l m n o p q r s t
170  = Tup20 a b c d e f g h i j k l m n o p q r s t
171 data Tuple21 a b c d e f g h i j k l m n o p q r s t u
172  = Tup21 a b c d e f g h i j k l m n o p q r s t u
173 data Tuple22 a b c d e f g h i j k l m n o p q r s t u v
174  = Tup22 a b c d e f g h i j k l m n o p q r s t u v
175 data Tuple23 a b c d e f g h i j k l m n o p q r s t u v w
176  = Tup23 a b c d e f g h i j k l m n o p q r s t u v w
177 data Tuple24 a b c d e f g h i j k l m n o p q r s t u v w x
178  = Tup24 a b c d e f g h i j k l m n o p q r s t u v w x
179 data Tuple25 a b c d e f g h i j k l m n o p q r s t u v w x y
180  = Tup25 a b c d e f g h i j k l m n o p q r s t u v w x y
181 data Tuple26 a b c d e f g h i j k l m n o p q r s t u v w x y z
182  = Tup26 a b c d e f g h i j k l m n o p q r s t u v w x y z
183 data Tuple27 a b c d e f g h i j k l m n o p q r s t u v w x y z a_
184  = Tup27 a b c d e f g h i j k l m n o p q r s t u v w x y z a_
185 data Tuple28 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_
186  = Tup28 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_
187 data Tuple29 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_
188  = Tup29 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_
189 data Tuple30 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_
190  = Tup30 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_
191 data Tuple31 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_
192  = Tup31 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_
193 data Tuple32 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_
194  = Tup32 a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_
195
196 {-# GENERATE_SPECS data a b :: Tuple2 a b #-}
197 {-# GENERATE_SPECS data a b c :: Tuple3 a b c #-}
198 {-# GENERATE_SPECS data a b c d :: Tuple4 a b c d #-}
199
200 {-# SPECIALIZE data Tuple5 Int# Int# Int# Int# Int# #-}
201 {-# SPECIALIZE data Tuple5 Char# Char# Char# Char# Char# #-}
202 {-# SPECIALIZE data Tuple5 Double# Double# Double# Double# Double# #-}
203
204 -- Check this out ... We need this for instance Floating Double# ...
205
206 {-# SPECIALIZE data Tuple19 a Double# b c d e f g h i j k l m n o p q r #-}
207
208 ----------------------------------------------------
209 -- Ratio: in PreludeRatio
210
211 data Bin = Bin_____________ -- placeholder only
212
213 -- IO things: in PreludeIO
214
215 data _Lift a = _Lift a
216 {-# GENERATE_SPECS data a :: _Lift a #-}