[Haskell-cafe] How to deal with huge text file?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Mon May 24 21:41:19 EDT 2010


Hi,
  I have a file including some operation logs, in the format of the
following. And I have some code to analyze it. Well, it ate all my
memories.
---
log:
 Log for item A
===========
09:10 read accountA
09:20 read accountB

 Log for item B
....
---
code:
  file <- U.readFile filename
  mapM_ (\text ->
          let ope = parseOPE text in
          if findMissingOperation ope
            then U.putStrLn $ show $ fst ope
            else return ()
        ) $ seperateOutput file --This function separates the input
text file into paragraph by "Log for".
-- 
竹密岂妨流水过
山高哪阻野云飞


More information about the Haskell-Cafe mailing list