@@ -9,6 +9,7 @@ import Data.Int (Int64)
99import Data.Word (Word8, Word16, Word32)
1010import Data.String (IsString, fromString)
1111import qualified Data.Text as T
12+import Data.Text.Foreign (I16)
1213import qualified Data.Text.Lazy as TL
1314import System.Random (Random(..), RandomGen)
1415import Test.QuickCheck hiding ((.&.))
@@ -21,6 +22,13 @@ instance Random Int64 where
2122instance Arbitrary Int64 where
2223 arbitrary = choose (minBound,maxBound)
2324
25+instance Random I16 where
26+ randomR = integralRandomR
27+ random = randomR (minBound,maxBound)
28+
29+instance Arbitrary I16 where
30+ arbitrary = choose (minBound,maxBound)
31+
2432instance Random Word8 where
2533 randomR = integralRandomR
2634 random = randomR (minBound,maxBound)
@@ -137,8 +145,8 @@ data Small = S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7
137145 | S24 | S25 | S26 | S27 | S28 | S29 | S30 | S31
138146 deriving (Eq, Ord, Enum, Bounded)
139147
140−small :: Small -> Int
141−small = fromEnum
148+small :: Integral a => Small -> a
149+small = fromIntegral . fromEnum
142150
143151intf f a b = toEnum ((fromEnum a `f` fromEnum b) `mod` 32)
144152