#include "MachDeps.h"
+-- #hide
module GHC.Word (
Word(..), Word8(..), Word16(..), Word32(..), Word64(..),
toEnumError, fromEnumError, succError, predError)
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral (i - m)
inRange (m,n) i = m <= i && i <= n
- unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1
instance Read Word where
readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral (i - m)
inRange (m,n) i = m <= i && i <= n
- unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1
instance Read Word8 where
readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral (i - m)
inRange (m,n) i = m <= i && i <= n
- unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1
instance Read Word16 where
readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral (i - m)
inRange (m,n) i = m <= i && i <= n
- unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1
instance Read Word32 where
#if WORD_SIZE_IN_BITS < 33
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral (i - m)
inRange (m,n) i = m <= i && i <= n
- unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1
instance Read Word64 where
readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]