X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FilxGen%2Ftests%2Ftest11.hs;fp=ghc%2Fcompiler%2FilxGen%2Ftests%2Ftest11.hs;h=0000000000000000000000000000000000000000;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hp=ce53f7138906d41b1d501ac260419749de2e9163;hpb=28a464a75e14cece5db40f2765a29348273ff2d2;p=ghc-hetmet.git diff --git a/ghc/compiler/ilxGen/tests/test11.hs b/ghc/compiler/ilxGen/tests/test11.hs deleted file mode 100644 index ce53f71..0000000 --- a/ghc/compiler/ilxGen/tests/test11.hs +++ /dev/null @@ -1,61 +0,0 @@ -{-# OPTIONS -fglasgow-exts #-} - -import PrelGHC - -class EEq a where - (===), (/==) :: a -> a -> Bool - --- x /= y = not (x == y) --- x == y = not (x /= y) --- x /= y = True - (/==) x y = mynot ((===) x y) - x === y = True - -data EOrdering = ELT | EEQ | EGT - -mynot True = False -mynot False = True - -{- -class (EEq a) => EOrd a where - ecompare :: a -> a -> EOrdering - (<<), (<<=), (>>>=), (>>>):: a -> a -> Bool - emax, emin :: a -> a -> a - --- An instance of Ord should define either compare or <= --- Using compare can be more efficient for complex types. - ecompare x y - | x === y = EEQ - | x <<= y = ELT -- NB: must be '<=' not '<' to validate the - -- above claim about the minimal things that can - -- be defined for an instance of Ord - | otherwise = EGT - - x <<= y = case ecompare x y of { EGT -> False; _other -> True } - x << y = case ecompare x y of { ELT -> True; _other -> False } - x >>>= y = case ecompare x y of { ELT -> False; _other -> True } - x >>> y = case ecompare x y of { EGT -> True; _other -> False } - - -- These two default methods use '>' rather than compare - -- because the latter is often more expensive - emax x y = if x >>> y then x else y - emin x y = if x >>> y then y else x --} - -data EInt = EI Int# - -ezeroInt, eoneInt, etwoInt, emaxInt, eminInt :: EInt -ezeroInt = EI 0# -eoneInt = EI 1# -etwoInt = EI 2# -eminInt = EI (-2147483648#) -- GHC <= 2.09 had this at -2147483647 -emaxInt = EI 2147483647# -eeqInt (EI x) (EI y) = x ==# y -eneInt (EI x) (EI y) = x /=# y - -instance EEq EInt where - (===) x y = x `eeqInt` y - (/==) x y = x `eneInt` y - -main = putStr (if (ezeroInt === eoneInt) then "no!\n" else "yes!\n") -