1 --- normal-strings/mergesort.hs 2008-06-06 09:28:55.000000000 +0200 2 +++ bytestrings/mergesort.hs 2008-06-06 09:33:27.000000000 +0200 3 @@ -1,5 +1,6 @@ 4 module Main(main) where 5 6 +import qualified Data.ByteString as BS 7 import qualified IO 8 import System(getArgs) 9 import Monad(mapM_) 10 @@ -44,6 +45,6 @@ 11 case fileh of 12 -- Read text from file handle, sort it and print to stdout. 13 Just fileh -> do text_to_sort <- Scaffolding.readLines fileh [] 14 - mapM_ IO.putStrLn (mergesort text_to_sort) 15 + mapM_ BS.putStrLn (mergesort text_to_sort) 16 -- We failed to open the file specified (if any). 17 Nothing -> do return () 18 --- normal-strings/Scaffolding.hs 2008-06-03 09:40:15.000000000 +0200 19 +++ bytestrings/Scaffolding.hs 2008-06-06 09:33:38.000000000 +0200 20 @@ -1,6 +1,7 @@ 21 module Scaffolding(readLines, openFile) where 22 23 import qualified IO 24 +import qualified Data.ByteString as BS 25 26 readLines fhandle acc = 27 do s <- sreadLine fhandle 28 @@ -9,7 +10,7 @@ 29 Nothing -> do return (reverse acc) 30 31 sreadLine fhandle = 32 - catch (do l <- IO.hGetLine fhandle 33 + catch (do l <- BS.hGetLine fhandle 34 return (Just l)) 35 (readErrHandler fhandle) 36