[Haskell-cafe] Takusen and strictness

Paul Moore p.f.moore at gmail.com
Fri Mar 2 09:58:21 EST 2007


On 02/03/07, Bayley, Alistair <Alistair_Bayley at invescoperpetual.co.uk> wrote:
> There's a big difference between getContents and Takusen: getContents
> has a non-trivial implementation (using unsafeInterleaveIO) that allows
> it to return data lazily. Takusen has no such implementation.

... ie, there's deep dark magic involved in the seemingly simple
getContents, which isn't easily available to mere mortals (or even
semi-immortal library designers). That figures. It's a shame, but not
totally unsurprising.

> > That's what my earlier code looked like, and I found it harder to
> > understand than the getContents/process/put approach. I'm trying to
> > explore ways of factoring data manipulation code out of database
> > access functions, but maybe that's not the right way of doing it.
>
> I don't think it's possible to pursue this style of programming with
> Takusen. If you do, you'll have to process the entire result-set into a
> data structure and then process it, which has obvious memory
> implications.

Oh, well. It's mostly irrelevant for me anyway, as the data sets I'm
actually playing with are small enough that slurping them into memory
isn't an issue - so I just choose between a simple and decoupled
implementation or a more complex and scalable one, which is a fairly
standard optimisation choice.

Thanks for clarifying.
Paul.


More information about the Haskell-Cafe mailing list