Commits

Bryan O'Sullivan committed eed56b4

Tidy up the Utf16 module

Comments (0)

Files changed (1)

Data/Text/Utf16.hs

 {-# LANGUAGE MagicHash #-}
 
-module Data.Text.Utf16 where
+module Data.Text.Utf16
+    (
+     chr2
+    , validate1
+    , validate2
+    ) where
 
 import GHC.Exts
-import GHC.Word
-
-import Data.Word
+import GHC.Word (Word16(..))
 
 chr2 :: Word16 -> Word16 -> Char
 chr2 (W16# a#) (W16# b#) = C# (chr# (upper# +# lower# +# 0x10000#))
 
 validate1    :: Word16 -> Bool
 validate1 x1 = (x1 >= 0 && x1 < 0xD800) || (x1 > 0xDFFF && x1 < 0x10000)
+{-# INLINE validate1 #-}
 
 validate2       ::  Word16 -> Word16 -> Bool
-validate2 x1 x2 = (x1 >= 0xD800 && x1 <= 0xDBFF) &&
-                  (x2 >= 0xDC00 && x2 <= 0xDFFF)
+validate2 x1 x2 = x1 >= 0xD800 && x1 <= 0xDBFF &&
+                  x2 >= 0xDC00 && x2 <= 0xDFFF
+{-# INLINE validate2 #-}