[code cleanups
John Meacham <john@repetae.net>**20051019035301] hunk ./Options.hs 4
-import Control.Monad.Error
hunk ./Options.hs 5
-import GenUtil
hunk ./Options.hs 7
-import qualified FlagDump
-import qualified FlagOpts
hunk ./Options.hs 11
+
+import GenUtil
+import qualified FlagDump
+import qualified FlagOpts
hunk ./PackedString.hs 1
+{-# OPTIONS_GHC -ffi #-}
hunk ./PackedString.hs 73
-	-- * I\/O with @PackedString@s	
+	-- * I\/O with @PackedString@s
hunk ./PackedString.hs 81
-import Prelude
-
-
-import Data.Array.Unboxed
hunk ./PackedString.hs 85
-import Int
hunk ./PackedString.hs 90
-import Data.Generics
-import Data.Generics.Basics
+import Data.Generics(Data(..))
+import Foreign.C.Types
hunk ./PackedString.hs 114
-   (PS x) == (PS y)  =  x == y
+    (==) (PS x) (PS y) =  x == y
+    (/=) (PS x) (PS y) =  x /= y
+    {-
+   (PS (UArray _ (I# e) ba)) == (PS (UArray _ (I# e') ba'))
+    | e ==# e' = c_memcmp ba ba' (e +# 1#) ==# 0#
+    | otherwise = False
+    -}
hunk ./PackedString.hs 124
-
+    {-
+    compare (PS (UArray _ (I# e) ba)) (PS (UArray _ (I# e') ba'))
+        | e <# e' =  f LT (c_memcmp ba ba' (e +# 1#))
+        | e ># e' =  f GT (c_memcmp ba ba' (e' +# 1#))
+        | e ==# e' = f EQ (c_memcmp ba ba' (e +# 1#))
+            where
+            f eq 0# = eq
+            f _ x | x ># 0# = GT
+            f _ _ = LT
+     -}
hunk ./PackedString.hs 139
+-- this is effectivly pure.
+--foreign import ccall unsafe "memcmp" c_memcmp :: ByteArray# -> ByteArray# -> Int# -> Int#
hunk ./SelfTest.hs 4
+import List(sort)
hunk ./SelfTest.hs 16
+import GenUtil
hunk ./SelfTest.hs 42
+
+--strings = [ "foo", "foobar", "baz", "", "bob"]
+strings =  ["h","n\206^um\198(","\186","yOw\246$\187x#",";\221x<n","\201\209\236\213J\244\233","\189eW\176v\175\209"]
+
hunk ./SelfTest.hs 52
+        prop_sort xs = sort (map packString xs) == map packString (sort xs)
hunk ./SelfTest.hs 55
+    doTime "prop_sort" $ quickCheck prop_sort
hunk ./SelfTest.hs 58
+    print $ map packString strings
+    print $ sort $ map packString strings
+    print $ sort strings