summaryrefslogtreecommitdiff
path: root/testsuite/tests/unboxedsums/ManyUbxSums_Addr.hs
blob: 6e718168e8ee15bd2d8f1a853e879ee89e9d6352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnboxedSums #-}

{-# OPTIONS_GHC -Wno-missing-methods #-}

module ManyUbxSums_Addr where

import GHC.Exts
-- import GHC.Word
-- import GHC.Int
--import GHC.Utils.Misc

data Addr = Addr Addr#

instance Eq Addr where
    (Addr x) == (Addr y) = case (eqAddr# x y) of
      1# -> True
      0# -> False

instance Num Addr where
  fromInteger x = case fromIntegral x of I# x1 -> Addr (int2Addr# x1)

instance Bounded Addr where
  maxBound = fromIntegral (maxBound :: Word)
  minBound = 0