Yes, with FPS it works! And is so elegant!
Thanks!
Atila
Duncan Coutts wrote:
On Thu, 2006-06-08 at 11:49 -0300, Atila Romero wrote:
Im trying to use parsec to split a file, using the null character as a
separator.
Works fine with very small files but fails if they are a little bit larger.
I guess parsec is trying to parse everthing first and print the results
last.
I think so.
Am I doing something wrong or parsec is just not the right tool to the job?
Right. In this case I would use lazy byte strings.
module main where
import qualified Data.ByteString.Lazy as B
main = do
input <- B.getContents
let emails = B.split 0 input
...
This lazily reads and splits into chunks using a 0 byte as separator.
However this needs a fairly recent version of the 'fps' package. (In ghc
6.6 Data.ByteString and Data.ByteString.Lazy will be provided in the
base package.)
Duncan
_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe