1{-# LANGUAGE CPP, Trustworthy #-}
2{-# LANGUAGE NoImplicitPrelude, MagicHash, StandaloneDeriving, BangPatterns,
3             KindSignatures, DataKinds, ConstraintKinds,
4              MultiParamTypeClasses, FunctionalDependencies #-}
5{-# LANGUAGE AllowAmbiguousTypes #-}
6  -- ip :: IP x a => a  is strictly speaking ambiguous, but IP is magic
7{-# LANGUAGE UndecidableSuperClasses #-}
8  -- Because of the type-variable superclasses for tuples
9
10{-# OPTIONS_GHC -Wno-unused-imports #-}
11-- -Wno-unused-imports needed for the GHC.Tuple import below. Sigh.
12
13{-# OPTIONS_GHC -Wno-unused-top-binds #-}
14-- -Wno-unused-top-binds is there (I hope) to stop Haddock complaining
15-- about the constraint tuples being defined but not used
16
17{-# OPTIONS_HADDOCK not-home #-}
18-----------------------------------------------------------------------------
19-- |
20-- Module      :  GHC.Classes
21-- Copyright   :  (c) The University of Glasgow, 1992-2002
22-- License     :  see libraries/base/LICENSE
23--
24-- Maintainer  :  cvs-ghc@haskell.org
25-- Stability   :  internal
26-- Portability :  non-portable (GHC extensions)
27--
28-- Basic classes.
29--
30-----------------------------------------------------------------------------
31
32module GHC.Classes(
33    -- * Implicit paramaters
34    IP(..),
35
36    -- * Equality and ordering
37    Eq(..),
38    Ord(..),
39    -- ** Monomorphic equality operators
40    -- $matching_overloaded_methods_in_rules
41    eqInt, neInt,
42    eqWord, neWord,
43    eqChar, neChar,
44    eqFloat, eqDouble,
45    -- ** Monomorphic comparison operators
46    gtInt, geInt, leInt, ltInt, compareInt, compareInt#,
47    gtWord, geWord, leWord, ltWord, compareWord, compareWord#,
48
49    -- * Functions over Bool
50    (&&), (||), not,
51
52    -- * Integer arithmetic
53    divInt#, modInt#
54 ) where
55
56-- GHC.Magic is used in some derived instances
57import GHC.Magic ()
58import GHC.IntWord64
59import GHC.Prim
60import GHC.Tuple
61import GHC.CString (unpackCString#)
62import GHC.Types
63
64#include "MachDeps.h"
65
66infix  4  ==, /=, <, <=, >=, >
67infixr 3  &&
68infixr 2  ||
69
70default ()              -- Double isn't available yet
71
72-- | The syntax @?x :: a@ is desugared into @IP "x" a@
73-- IP is declared very early, so that libraries can take
74-- advantage of the implicit-call-stack feature
75class IP (x :: Symbol) a | x -> a where
76  ip :: a
77
78{- $matching_overloaded_methods_in_rules
79
80Matching on class methods (e.g. @(==)@) in rewrite rules tends to be a bit
81fragile. For instance, consider this motivating example from the @bytestring@
82library,
83
84@
85break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
86breakByte :: Word8 -> ByteString -> (ByteString, ByteString)
87\{\-\# RULES "break -> breakByte" forall a. break (== x) = breakByte x \#\-\}
88@
89
90Here we have two functions, with @breakByte@ providing an optimized
91implementation of @break@ where the predicate is merely testing for equality
92with a known @Word8@. As written, however, this rule will be quite fragile as
93the @(==)@ class operation rule may rewrite the predicate before our @break@
94rule has a chance to fire.
95
96For this reason, most of the primitive types in @base@ have 'Eq' and 'Ord'
97instances defined in terms of helper functions with inlinings delayed to phase
981. For instance, @Word8@\'s @Eq@ instance looks like,
99
100@
101instance Eq Word8 where
102    (==) = eqWord8
103    (/=) = neWord8
104
105eqWord8, neWord8 :: Word8 -> Word8 -> Bool
106eqWord8 (W8# x) (W8# y) = ...
107neWord8 (W8# x) (W8# y) = ...
108\{\-\# INLINE [1] eqWord8 \#\-\}
109\{\-\# INLINE [1] neWord8 \#\-\}
110@
111
112This allows us to save our @break@ rule above by rewriting it to instead match
113against @eqWord8@,
114
115@
116\{\-\# RULES "break -> breakByte" forall a. break (`eqWord8` x) = breakByte x \#\-\}
117@
118
119Currently this is only done for @('==')@, @('/=')@, @('<')@, @('<=')@, @('>')@,
120and @('>=')@ for the types in "GHC.Word" and "GHC.Int".
121-}
122
123-- | The 'Eq' class defines equality ('==') and inequality ('/=').
124-- All the basic datatypes exported by the "Prelude" are instances of 'Eq',
125-- and 'Eq' may be derived for any datatype whose constituents are also
126-- instances of 'Eq'.
127--
128-- The Haskell Report defines no laws for 'Eq'. However, '==' is customarily
129-- expected to implement an equivalence relationship where two values comparing
130-- equal are indistinguishable by "public" functions, with a "public" function
131-- being one not allowing to see implementation details. For example, for a
132-- type representing non-normalised natural numbers modulo 100, a "public"
133-- function doesn't make the difference between 1 and 201. It is expected to
134-- have the following properties:
135--
136-- [__Reflexivity__]: @x == x@ = 'True'
137-- [__Symmetry__]: @x == y@ = @y == x@
138-- [__Transitivity__]: if @x == y && y == z@ = 'True', then @x == z@ = 'True'
139-- [__Substitutivity__]: if @x == y@ = 'True' and @f@ is a "public" function
140-- whose return type is an instance of 'Eq', then @f x == f y@ = 'True'
141-- [__Negation__]: @x /= y@ = @not (x == y)@
142--
143-- Minimal complete definition: either '==' or '/='.
144--
145class  Eq a  where
146    (==), (/=)           :: a -> a -> Bool
147
148    {-# INLINE (/=) #-}
149    {-# INLINE (==) #-}
150    x /= y               = not (x == y)
151    x == y               = not (x /= y)
152    {-# MINIMAL (==) | (/=) #-}
153
154deriving instance Eq ()
155deriving instance (Eq  a, Eq  b) => Eq  (a, b)
156deriving instance (Eq  a, Eq  b, Eq  c) => Eq  (a, b, c)
157deriving instance (Eq  a, Eq  b, Eq  c, Eq  d) => Eq  (a, b, c, d)
158deriving instance (Eq  a, Eq  b, Eq  c, Eq  d, Eq  e) => Eq  (a, b, c, d, e)
159deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f)
160               => Eq (a, b, c, d, e, f)
161deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g)
162               => Eq (a, b, c, d, e, f, g)
163deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
164                   Eq h)
165               => Eq (a, b, c, d, e, f, g, h)
166deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
167                   Eq h, Eq i)
168               => Eq (a, b, c, d, e, f, g, h, i)
169deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
170                   Eq h, Eq i, Eq j)
171               => Eq (a, b, c, d, e, f, g, h, i, j)
172deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
173                   Eq h, Eq i, Eq j, Eq k)
174               => Eq (a, b, c, d, e, f, g, h, i, j, k)
175deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
176                   Eq h, Eq i, Eq j, Eq k, Eq l)
177               => Eq (a, b, c, d, e, f, g, h, i, j, k, l)
178deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
179                   Eq h, Eq i, Eq j, Eq k, Eq l, Eq m)
180               => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m)
181deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
182                   Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n)
183               => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
184deriving instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g,
185                   Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o)
186               => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
187
188instance (Eq a) => Eq [a] where
189    {-# SPECIALISE instance Eq [[Char]] #-}
190    {-# SPECIALISE instance Eq [Char] #-}
191    {-# SPECIALISE instance Eq [Int] #-}
192    []     == []     = True
193    (x:xs) == (y:ys) = x == y && xs == ys
194    _xs    == _ys    = False
195
196deriving instance Eq Module
197
198instance Eq TrName where
199    TrNameS a == TrNameS b = isTrue# (a `eqAddr#` b)
200    a == b = toString a == toString b
201      where
202        toString (TrNameS s) = unpackCString# s
203        toString (TrNameD s) = s
204
205deriving instance Eq Bool
206deriving instance Eq Ordering
207
208instance Eq Word where
209    (==) = eqWord
210    (/=) = neWord
211
212-- See GHC.Classes#matching_overloaded_methods_in_rules
213{-# INLINE [1] eqWord #-}
214{-# INLINE [1] neWord #-}
215eqWord, neWord :: Word -> Word -> Bool
216(W# x) `eqWord` (W# y) = isTrue# (x `eqWord#` y)
217(W# x) `neWord` (W# y) = isTrue# (x `neWord#` y)
218
219-- See GHC.Classes#matching_overloaded_methods_in_rules
220instance Eq Char where
221    (==) = eqChar
222    (/=) = neChar
223
224-- See GHC.Classes#matching_overloaded_methods_in_rules
225{-# INLINE [1] eqChar #-}
226{-# INLINE [1] neChar #-}
227eqChar, neChar :: Char -> Char -> Bool
228(C# x) `eqChar` (C# y) = isTrue# (x `eqChar#` y)
229(C# x) `neChar` (C# y) = isTrue# (x `neChar#` y)
230
231-- | Note that due to the presence of @NaN@, `Float`'s 'Eq' instance does not
232-- satisfy reflexivity.
233--
234-- >>> 0/0 == (0/0 :: Float)
235-- False
236--
237-- Also note that `Float`'s 'Eq' instance does not satisfy substitutivity:
238--
239-- >>> 0 == (-0 :: Float)
240-- True
241-- >>> recip 0 == recip (-0 :: Float)
242-- False
243instance Eq Float where
244    (==) = eqFloat
245
246-- See GHC.Classes#matching_overloaded_methods_in_rules
247{-# INLINE [1] eqFloat #-}
248eqFloat :: Float -> Float -> Bool
249(F# x) `eqFloat` (F# y) = isTrue# (x `eqFloat#` y)
250
251-- | Note that due to the presence of @NaN@, `Double`'s 'Eq' instance does not
252-- satisfy reflexivity.
253--
254-- >>> 0/0 == (0/0 :: Double)
255-- False
256--
257-- Also note that `Double`'s 'Eq' instance does not satisfy substitutivity:
258--
259-- >>> 0 == (-0 :: Double)
260-- True
261-- >>> recip 0 == recip (-0 :: Double)
262-- False
263instance Eq Double where
264    (==) = eqDouble
265
266-- See GHC.Classes#matching_overloaded_methods_in_rules
267{-# INLINE [1] eqDouble #-}
268eqDouble :: Double -> Double -> Bool
269(D# x) `eqDouble` (D# y) = isTrue# (x ==## y)
270
271instance Eq Int where
272    (==) = eqInt
273    (/=) = neInt
274
275-- See GHC.Classes#matching_overloaded_methods_in_rules
276{-# INLINE [1] eqInt #-}
277{-# INLINE [1] neInt #-}
278eqInt, neInt :: Int -> Int -> Bool
279(I# x) `eqInt` (I# y) = isTrue# (x ==# y)
280(I# x) `neInt` (I# y) = isTrue# (x /=# y)
281
282#if WORD_SIZE_IN_BITS < 64
283instance Eq TyCon where
284  (==) (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
285       = isTrue# (hi1 `eqWord64#` hi2) && isTrue# (lo1 `eqWord64#` lo2)
286instance Ord TyCon where
287  compare (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
288    | isTrue# (hi1 `gtWord64#` hi2) = GT
289    | isTrue# (hi1 `ltWord64#` hi2) = LT
290    | isTrue# (lo1 `gtWord64#` lo2) = GT
291    | isTrue# (lo1 `ltWord64#` lo2) = LT
292    | True                = EQ
293#else
294instance Eq TyCon where
295  (==) (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
296       = isTrue# (hi1 `eqWord#` hi2) && isTrue# (lo1 `eqWord#` lo2)
297instance Ord TyCon where
298  compare (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
299    | isTrue# (hi1 `gtWord#` hi2) = GT
300    | isTrue# (hi1 `ltWord#` hi2) = LT
301    | isTrue# (lo1 `gtWord#` lo2) = GT
302    | isTrue# (lo1 `ltWord#` lo2) = LT
303    | True              = EQ
304#endif
305
306
307-- | The 'Ord' class is used for totally ordered datatypes.
308--
309-- Instances of 'Ord' can be derived for any user-defined datatype whose
310-- constituent types are in 'Ord'. The declared order of the constructors in
311-- the data declaration determines the ordering in derived 'Ord' instances. The
312-- 'Ordering' datatype allows a single comparison to determine the precise
313-- ordering of two objects.
314--
315-- The Haskell Report defines no laws for 'Ord'. However, '<=' is customarily
316-- expected to implement a non-strict partial order and have the following
317-- properties:
318--
319-- [__Transitivity__]: if @x <= y && y <= z@ = 'True', then @x <= z@ = 'True'
320-- [__Reflexivity__]: @x <= x@ = 'True'
321-- [__Antisymmetry__]: if @x <= y && y <= x@ = 'True', then @x == y@ = 'True'
322--
323-- Note that the following operator interactions are expected to hold:
324--
325-- 1. @x >= y@ = @y <= x@
326-- 2. @x < y@ = @x <= y && x /= y@
327-- 3. @x > y@ = @y < x@
328-- 4. @x < y@ = @compare x y == LT@
329-- 5. @x > y@ = @compare x y == GT@
330-- 6. @x == y@ = @compare x y == EQ@
331-- 7. @min x y == if x <= y then x else y@ = 'True'
332-- 8. @max x y == if x >= y then x else y@ = 'True'
333--
334-- Note that (7.) and (8.) do /not/ require 'min' and 'max' to return either of
335-- their arguments. The result is merely required to /equal/ one of the
336-- arguments in terms of '(==)'.
337--
338-- Minimal complete definition: either 'compare' or '<='.
339-- Using 'compare' can be more efficient for complex types.
340--
341class  (Eq a) => Ord a  where
342    compare              :: a -> a -> Ordering
343    (<), (<=), (>), (>=) :: a -> a -> Bool
344    max, min             :: a -> a -> a
345
346    compare x y = if x == y then EQ
347                  -- NB: must be '<=' not '<' to validate the
348                  -- above claim about the minimal things that
349                  -- can be defined for an instance of Ord:
350                  else if x <= y then LT
351                  else GT
352
353    x <  y = case compare x y of { LT -> True;  _ -> False }
354    x <= y = case compare x y of { GT -> False; _ -> True }
355    x >  y = case compare x y of { GT -> True;  _ -> False }
356    x >= y = case compare x y of { LT -> False; _ -> True }
357
358        -- These two default methods use '<=' rather than 'compare'
359        -- because the latter is often more expensive
360    max x y = if x <= y then y else x
361    min x y = if x <= y then x else y
362    {-# MINIMAL compare | (<=) #-}
363
364deriving instance Ord ()
365deriving instance (Ord a, Ord b) => Ord (a, b)
366deriving instance (Ord a, Ord b, Ord c) => Ord (a, b, c)
367deriving instance (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d)
368deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e)
369deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f)
370               => Ord (a, b, c, d, e, f)
371deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g)
372               => Ord (a, b, c, d, e, f, g)
373deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
374                   Ord h)
375               => Ord (a, b, c, d, e, f, g, h)
376deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
377                   Ord h, Ord i)
378               => Ord (a, b, c, d, e, f, g, h, i)
379deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
380                   Ord h, Ord i, Ord j)
381               => Ord (a, b, c, d, e, f, g, h, i, j)
382deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
383                   Ord h, Ord i, Ord j, Ord k)
384               => Ord (a, b, c, d, e, f, g, h, i, j, k)
385deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
386                   Ord h, Ord i, Ord j, Ord k, Ord l)
387               => Ord (a, b, c, d, e, f, g, h, i, j, k, l)
388deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
389                   Ord h, Ord i, Ord j, Ord k, Ord l, Ord m)
390               => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m)
391deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
392                   Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n)
393               => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
394deriving instance (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g,
395                   Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o)
396               => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
397
398instance (Ord a) => Ord [a] where
399    {-# SPECIALISE instance Ord [[Char]] #-}
400    {-# SPECIALISE instance Ord [Char] #-}
401    {-# SPECIALISE instance Ord [Int] #-}
402    compare []     []     = EQ
403    compare []     (_:_)  = LT
404    compare (_:_)  []     = GT
405    compare (x:xs) (y:ys) = case compare x y of
406                                EQ    -> compare xs ys
407                                other -> other
408
409deriving instance Ord Bool
410deriving instance Ord Ordering
411
412-- We don't use deriving for Ord Char, because for Ord the derived
413-- instance defines only compare, which takes two primops.  Then
414-- '>' uses compare, and therefore takes two primops instead of one.
415instance Ord Char where
416    (C# c1) >  (C# c2) = isTrue# (c1 `gtChar#` c2)
417    (C# c1) >= (C# c2) = isTrue# (c1 `geChar#` c2)
418    (C# c1) <= (C# c2) = isTrue# (c1 `leChar#` c2)
419    (C# c1) <  (C# c2) = isTrue# (c1 `ltChar#` c2)
420
421-- | Note that due to the presence of @NaN@, `Float`'s 'Ord' instance does not
422-- satisfy reflexivity.
423--
424-- >>> 0/0 <= (0/0 :: Float)
425-- False
426--
427-- Also note that, due to the same, `Ord`'s operator interactions are not
428-- respected by `Float`'s instance:
429--
430-- >>> (0/0 :: Float) > 1
431-- False
432-- >>> compare (0/0 :: Float) 1
433-- GT
434instance Ord Float where
435    (F# x) `compare` (F# y)
436        = if      isTrue# (x `ltFloat#` y) then LT
437          else if isTrue# (x `eqFloat#` y) then EQ
438          else                                  GT
439
440    (F# x) <  (F# y) = isTrue# (x `ltFloat#` y)
441    (F# x) <= (F# y) = isTrue# (x `leFloat#` y)
442    (F# x) >= (F# y) = isTrue# (x `geFloat#` y)
443    (F# x) >  (F# y) = isTrue# (x `gtFloat#` y)
444
445-- | Note that due to the presence of @NaN@, `Double`'s 'Ord' instance does not
446-- satisfy reflexivity.
447--
448-- >>> 0/0 <= (0/0 :: Double)
449-- False
450--
451-- Also note that, due to the same, `Ord`'s operator interactions are not
452-- respected by `Double`'s instance:
453--
454-- >>> (0/0 :: Double) > 1
455-- False
456-- >>> compare (0/0 :: Double) 1
457-- GT
458instance Ord Double where
459    (D# x) `compare` (D# y)
460        = if      isTrue# (x <##  y) then LT
461          else if isTrue# (x ==## y) then EQ
462          else                            GT
463
464    (D# x) <  (D# y) = isTrue# (x <##  y)
465    (D# x) <= (D# y) = isTrue# (x <=## y)
466    (D# x) >= (D# y) = isTrue# (x >=## y)
467    (D# x) >  (D# y) = isTrue# (x >##  y)
468
469instance Ord Int where
470    compare = compareInt
471    (<)     = ltInt
472    (<=)    = leInt
473    (>=)    = geInt
474    (>)     = gtInt
475
476-- See GHC.Classes#matching_overloaded_methods_in_rules
477{-# INLINE [1] gtInt #-}
478{-# INLINE [1] geInt #-}
479{-# INLINE [1] ltInt #-}
480{-# INLINE [1] leInt #-}
481gtInt, geInt, ltInt, leInt :: Int -> Int -> Bool
482(I# x) `gtInt` (I# y) = isTrue# (x >#  y)
483(I# x) `geInt` (I# y) = isTrue# (x >=# y)
484(I# x) `ltInt` (I# y) = isTrue# (x <#  y)
485(I# x) `leInt` (I# y) = isTrue# (x <=# y)
486
487compareInt :: Int -> Int -> Ordering
488(I# x#) `compareInt` (I# y#) = compareInt# x# y#
489
490compareInt# :: Int# -> Int# -> Ordering
491compareInt# x# y#
492    | isTrue# (x# <#  y#) = LT
493    | isTrue# (x# ==# y#) = EQ
494    | True                = GT
495
496instance Ord Word where
497    compare = compareWord
498    (<)     = ltWord
499    (<=)    = leWord
500    (>=)    = geWord
501    (>)     = gtWord
502
503-- See GHC.Classes#matching_overloaded_methods_in_rules
504{-# INLINE [1] gtWord #-}
505{-# INLINE [1] geWord #-}
506{-# INLINE [1] ltWord #-}
507{-# INLINE [1] leWord #-}
508gtWord, geWord, ltWord, leWord :: Word -> Word -> Bool
509(W# x) `gtWord` (W# y) = isTrue# (x `gtWord#` y)
510(W# x) `geWord` (W# y) = isTrue# (x `geWord#` y)
511(W# x) `ltWord` (W# y) = isTrue# (x `ltWord#` y)
512(W# x) `leWord` (W# y) = isTrue# (x `leWord#` y)
513
514compareWord :: Word -> Word -> Ordering
515(W# x#) `compareWord` (W# y#) = compareWord# x# y#
516
517compareWord# :: Word# -> Word# -> Ordering
518compareWord# x# y#
519    | isTrue# (x# `ltWord#` y#) = LT
520    | isTrue# (x# `eqWord#` y#) = EQ
521    | True                      = GT
522
523-- OK, so they're technically not part of a class...:
524
525-- Boolean functions
526
527-- | Boolean \"and\", lazy in the second argument
528(&&)                    :: Bool -> Bool -> Bool
529True  && x              =  x
530False && _              =  False
531
532-- | Boolean \"or\", lazy in the second argument
533(||)                    :: Bool -> Bool -> Bool
534True  || _              =  True
535False || x              =  x
536
537-- | Boolean \"not\"
538not                     :: Bool -> Bool
539not True                =  False
540not False               =  True
541
542
543------------------------------------------------------------------------
544-- These don't really belong here, but we don't have a better place to
545-- put them
546
547-- These functions have built-in rules.
548{-# NOINLINE [0] divInt# #-}
549{-# NOINLINE [0] modInt# #-}
550divInt# :: Int# -> Int# -> Int#
551x# `divInt#` y#
552        -- Be careful NOT to overflow if we do any additional arithmetic
553        -- on the arguments...  the following  previous version of this
554        -- code has problems with overflow:
555--    | (x# ># 0#) && (y# <# 0#) = ((x# -# y#) -# 1#) `quotInt#` y#
556--    | (x# <# 0#) && (y# ># 0#) = ((x# -# y#) +# 1#) `quotInt#` y#
557    =      if isTrue# (x# ># 0#) && isTrue# (y# <# 0#) then ((x# -# 1#) `quotInt#` y#) -# 1#
558      else if isTrue# (x# <# 0#) && isTrue# (y# ># 0#) then ((x# +# 1#) `quotInt#` y#) -# 1#
559      else x# `quotInt#` y#
560
561modInt# :: Int# -> Int# -> Int#
562x# `modInt#` y#
563    = if isTrue# (x# ># 0#) && isTrue# (y# <# 0#) ||
564         isTrue# (x# <# 0#) && isTrue# (y# ># 0#)
565      then if isTrue# (r# /=# 0#) then r# +# y# else 0#
566      else r#
567    where
568    !r# = x# `remInt#` y#
569
570
571{- *************************************************************
572*                                                              *
573*               Constraint tuples                              *
574*                                                              *
575************************************************************* -}
576
577class ()
578class (c1, c2)     => (c1, c2)
579class (c1, c2, c3) => (c1, c2, c3)
580class (c1, c2, c3, c4) => (c1, c2, c3, c4)
581class (c1, c2, c3, c4, c5) => (c1, c2, c3, c4, c5)
582class (c1, c2, c3, c4, c5, c6) => (c1, c2, c3, c4, c5, c6)
583class (c1, c2, c3, c4, c5, c6, c7) => (c1, c2, c3, c4, c5, c6, c7)
584class (c1, c2, c3, c4, c5, c6, c7, c8) => (c1, c2, c3, c4, c5, c6, c7, c8)
585class (c1, c2, c3, c4, c5, c6, c7, c8, c9)
586   => (c1, c2, c3, c4, c5, c6, c7, c8, c9)
587class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
588   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
589class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11)
590   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11)
591class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12)
592   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12)
593class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
594   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
595class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14)
596   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14)
597class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15)
598   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15)
599class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16)
600   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16)
601class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
602       c17)
603   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
604       c17)
605class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
606       c17,c18)
607   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
608       c17, c18)
609class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
610       c17, c18, c19)
611   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
612       c17, c18, c19)
613class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
614       c17, c18, c19, c20)
615   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
616       c17, c18, c19, c20)
617class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
618       c17, c18, c19, c20, c21)
619   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
620       c17, c18, c19, c20, c21)
621class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
622       c17, c18, c19, c20, c21, c22)
623   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
624       c17, c18, c19, c20, c21, c22)
625class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
626       c17, c18, c19, c20, c21, c22, c23)
627   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
628       c17, c18, c19, c20, c21, c22, c23)
629class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
630       c17, c18, c19, c20, c21, c22, c23, c24)
631   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
632       c17, c18, c19, c20, c21, c22, c23, c24)
633class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
634       c17, c18, c19, c20, c21, c22, c23, c24, c25)
635   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
636       c17, c18, c19, c20, c21, c22, c23, c24, c25)
637class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
638       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26)
639   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
640       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26)
641class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
642       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27)
643   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
644       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27)
645class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
646       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28)
647   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
648       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28)
649class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
650       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29)
651   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
652       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29)
653class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
654       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30)
655   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
656       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30)
657class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
658       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
659       c31)
660   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
661       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
662       c31)
663class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
664       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
665       c31, c32)
666   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
667       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
668       c31, c32)
669class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
670       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
671       c31, c32, c33)
672   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
673       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
674       c31, c32, c33)
675class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
676       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
677       c31, c32, c33, c34)
678   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
679       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
680       c31, c32, c33, c34)
681class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
682       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
683       c31, c32, c33, c34, c35)
684   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
685       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
686       c31, c32, c33, c34, c35)
687class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
688       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
689       c31, c32, c33, c34, c35, c36)
690   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
691       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
692       c31, c32, c33, c34, c35, c36)
693class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
694       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
695       c31, c32, c33, c34, c35, c36, c37)
696   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
697       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
698       c31, c32, c33, c34, c35, c36, c37)
699class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
700       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
701       c31, c32, c33, c34, c35, c36, c37, c38)
702   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
703       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
704       c31, c32, c33, c34, c35, c36, c37, c38)
705class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
706       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
707       c31, c32, c33, c34, c35, c36, c37, c38, c39)
708   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
709       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
710       c31, c32, c33, c34, c35, c36, c37, c38, c39)
711class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
712       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
713       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40)
714   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
715       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
716       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40)
717class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
718       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
719       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41)
720   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
721       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
722       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41)
723class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
724       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
725       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42)
726   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
727       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
728       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42)
729class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
730       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
731       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43)
732   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
733       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
734       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43)
735class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
736       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
737       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44)
738   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
739       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
740       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44)
741class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
742       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
743       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
744       c45)
745   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
746       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
747       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
748       c45)
749class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
750       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
751       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
752       c45, c46)
753   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
754       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
755       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
756       c45, c46)
757class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
758       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
759       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
760       c45, c46, c47)
761   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
762       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
763       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
764       c45, c46, c47)
765class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
766       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
767       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
768       c45, c46, c47, c48)
769   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
770       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
771       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
772       c45, c46, c47, c48)
773class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
774       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
775       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
776       c45, c46, c47, c48, c49)
777   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
778       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
779       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
780       c45, c46, c47, c48, c49)
781class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
782       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
783       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
784       c45, c46, c47, c48, c49, c50)
785   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
786       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
787       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
788       c45, c46, c47, c48, c49, c50)
789class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
790       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
791       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
792       c45, c46, c47, c48, c49, c50, c51)
793   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
794       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
795       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
796       c45, c46, c47, c48, c49, c50, c51)
797class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
798       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
799       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
800       c45, c46, c47, c48, c49, c50, c51, c52)
801   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
802       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
803       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
804       c45, c46, c47, c48, c49, c50, c51, c52)
805class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
806       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
807       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
808       c45, c46, c47, c48, c49, c50, c51, c52, c53)
809   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
810       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
811       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
812       c45, c46, c47, c48, c49, c50, c51, c52, c53)
813class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
814       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
815       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
816       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54)
817   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
818       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
819       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
820       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54)
821class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
822       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
823       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
824       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55)
825   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
826       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
827       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
828       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55)
829class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
830       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
831       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
832       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56)
833   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
834       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
835       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
836       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56)
837class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
838       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
839       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
840       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57)
841   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
842       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
843       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
844       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57)
845class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
846       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
847       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
848       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58)
849   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
850       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
851       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
852       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58)
853class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
854       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
855       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
856       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
857       c59)
858   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
859       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
860       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
861       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
862       c59)
863class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
864       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
865       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
866       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
867       c59, c60)
868   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
869       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
870       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
871       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
872       c59, c60)
873class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
874       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
875       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
876       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
877       c59, c60, c61)
878   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
879       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
880       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
881       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
882       c59, c60, c61)
883class (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
884       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
885       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
886       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
887       c59, c60, c61, c62)
888   => (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16,
889       c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
890       c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44,
891       c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58,
892       c59, c60, c61, c62)
893