[Haskell-cafe] stream/bytestring questions

Chad Scherrer chad.scherrer at gmail.com
Thu Feb 21 13:16:48 EST 2008


On Wed, Feb 20, 2008 at 5:53 PM, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
>  In general, I don't see why programming directly with streams is
>  something that should be avoided. You do have to be quite careful,
>  though, if you want to get good performance (but GHC's simplifier is
>  becoming increasingly robust in this respect).

Hmm. I was taking the approach of getting something working, given
what is currently exported from Data.Stream. How would you deal with
this? Should there be a Data.Stream.Internal or something that exports
streams and unlifted types?

If I'm understanding this correctly, these things were not exported in
the first place because this fusion framework provides an
approximation, but not an isomorphism, so partial bottoms don't always
behave nicely. I was hoping to get around this by programming instead
to Step and then hoping rules could be constructed to translate to
Streams. Do you think there's a better way around it?

>  > extract ns xs == [xs !! n | n <- ns]
>
>  Note that in contrast to your function, this doesn't assume that ns is
>  sorted and hence, there is no way to implement this without producing an
>  intermediate list.

Oh yes, good point. It's so easy to forget about assumptions like that.

Chad


More information about the Haskell-Cafe mailing list