
Thanks for your replies. Hoogle is pretty cool--I didn't know about that. I ended up with this, which is pretty close to the original (it will also bomb if given non-integer input): import qualified Data.ByteString.Lazy.Char8 as L import qualified Data.Maybe as M main = do contents <- L.getContents print (sumFile contents) where sumFile = sum . map (fst . M.fromJust . L.readInt) . L.words One further problem I've encountered: My Haskell program runs under 'runghc', but I get a link error when compiling it (GHC 6.8.2, latest Ubuntu). Any suggestions? $ ghc -o LazySumFile LazySumFile.hs LazySumFile.o: In function `sOz_info': (.text+0x200): undefined reference to `bytestringzm0zi9zi0zi1_DataziByteStringziLazzyziChar8_readInt_closure' LazySumFile.o: In function `sOF_info': (.text+0x35d): undefined reference to `bytestringzm0zi9zi0zi1_DataziByteStringziLazzyziChar8_words_closure' LazySumFile.o: In function `sRF_info': (.text+0x4d7): undefined reference to `bytestringzm0zi9zi0zi1_DataziByteStringziLazzy_getContents_closure' LazySumFile.o: In function `sRF_info': (.text+0x64f): undefined reference to `__stginit_bytestringzm0zi9zi0zi1_DataziByteStringziLazzyziChar8_' LazySumFile.o: In function `sOF_srt': (.data+0xa0): undefined reference to `bytestringzm0zi9zi0zi1_DataziByteStringziLazzyziChar8_words_closure' LazySumFile.o: In function `sOF_srt': (.data+0xa8): undefined reference to `bytestringzm0zi9zi0zi1_DataziByteStringziLazzyziChar8_readInt_closure' LazySumFile.o: In function `rOh_closure': (.data+0x110): undefined reference to `bytestringzm0zi9zi0zi1_DataziByteStringziLazzy_getContents_closure' collect2: ld returned 1 exit status