-- efficient operations. A 'PackedString' contains full Unicode 'Char's.
newtype PackedString = PS (UArray Int Char)
+-- ToDo: we could support "slices", i.e. include offset and length fields into
+-- the string, so that operations like take/drop could be O(1). Perhaps making
+-- a slice should be conditional on the ratio of the slice/string size to
+-- limit memory leaks.
+
instance Eq PackedString where
(PS x) == (PS y) = x == y
* joinPS (packString [x]) (splitPS x ls) = ls
-}
--- | The 'splitPS' function splits the input string on each occurance of the given 'Char'.
+-- | The 'splitPS' function splits the input string on each occurrence of the given 'Char'.
splitPS :: Char -> PackedString -> [PackedString]
splitPS c = splitWithPS (== c)
-- | Outputs a 'PackedString' to the specified 'Handle'.
--
-- NOTE: the representation of the 'PackedString' in the file is assumed to
--- be in the ISO-8859-1 encoding. In other words, only the least signficant
+-- be in the ISO-8859-1 encoding. In other words, only the least significant
-- byte is taken from each character in the 'PackedString'.
hPutPS :: Handle -> PackedString -> IO ()
hPutPS h (PS ps) = do