[Haskell-cafe] Parsec and binary files
atilaromero at yahoo.com.br
Thu Jun 8 12:50:06 EDT 2006
Yes, with FPS it works! And is so elegant!
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
>> 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
> 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.)
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
More information about the Haskell-Cafe