From: simonmar Date: Mon, 1 Mar 2004 14:47:30 +0000 (+0000) Subject: [project @ 2004-03-01 14:47:30 by simonmar] X-Git-Tag: nhc98-1-18-release~358 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=11cf8180e05e7219620cfbe4e6e2b83bb0ed6eaf;p=ghc-base.git [project @ 2004-03-01 14:47:30 by simonmar] small improvements from Ian Lynagh --- diff --git a/Data/PackedString.hs b/Data/PackedString.hs index cd4fad9..0db102a 100644 --- a/Data/PackedString.hs +++ b/Data/PackedString.hs @@ -116,7 +116,7 @@ packString str = packNChars (length str) str -- | The 'packNChars' function creates a 'PackedString' out of the -- first @len@ elements of the given 'String'. packNChars :: Int -> [Char] -> PackedString -packNChars len str = PS (array (0,len-1) (zip [0..] str)) +packNChars len str = PS (listArray (0,len-1) str) -- ----------------------------------------------------------------------------- -- Destructor functions (taking PackedStrings apart) @@ -332,7 +332,7 @@ hGetPS h i = do arr <- newArray_ (0, i-1) l <- hGetArray h arr i chars <- mapM (\i -> readArray arr i >>= return.chr.fromIntegral) [0..l-1] - return (packString chars) + return (packNChars l chars) #else /* __NHC__ */