[Haskell-cafe] Arrays in Clean and Haskell

Jason Dusek jason.dusek at gmail.com
Thu Nov 5 00:19:47 EST 2009


2009/11/04 Philippos Apolinarius <phi500ac at yahoo.ca>
> Let me see whether I understoodnd you correctly... If I read
> the contents of a file, the string will may be lazy (or
> something like that) and not consume memory?

  A `String` or a lazy `ByteString` will be lazy and consume
  minimal memory. You can parse lazy `ByteString`s with
  AttoParsec. To the best of my knowledge, the most patched up
  and version of that parser is here:

    http://hackage.haskell.org/package/bytestringparser-temporary/

  It is really in your best interest to parse with `ByteString`s
  instead of `String`s.

  Disclosure of conflict of interest: The package I mention is my
  own fork of Bryan O'Sullivan's AttoParsec (which is a little
  broken in places).

> In fewer words, will the string behave like the infinite list
> of random numbers that I have used in the examples I posted?

  In so far as it is lazy, yes.

  Lazy IO. A terrible idea, except when it's a good idea.

--
Jason Dusek


More information about the Haskell-Cafe mailing list