On Mon, Jul 11, 2011 at 6:27 PM, Michael Orlitzky <mich...@orlitzky.com> wrote:
> On 07/10/11 15:37, Felipe Almeida Lessa wrote:
>> You don't need to do it, it is already done =).  See the pool
>> package by Michael Snoyman on Hackage [1].  More specifically, see
>> createPoolCheckAlive [2].
>>
>> Cheers,
>>
>> [1] http://hackage.haskell.org/package/pool [2]
>> http://hackage.haskell.org/packages/archive/pool/0.1.0.2/doc/html/Data-Pool.html#v:createPoolCheckAlive
>>
>>
>
> How do people use this stuff? The README is empty, there's no
> documentation, and none of the functions are commented. I'm forced to
> conclude that there are people capable of looking at this,
>
>  createPoolCheckAlive :: MonadControlIO m
>                          => IO a
>                          -> (a -> IO ())
>                          -> Int
>                          -> (Pool a -> m b)
>                          -> (a -> IO Bool)
>                          -> m b
>
> and knowing immediately what it does.
>
> I'm still a beginner, and I don't think I have a use for this package
> (what does it do?), but I've run into similar situations with other
> packages and would genuinely like to know (as opposed to just complain
> about it).
>

Author of the package speaking. I agree, that's a problem :). I've
just uploaded a new version[1] that is properly documented, though it
will take a bit for Hackage to generates the Haddocks. As Brandon
said, the reason this wasn't documented in the first place is that it
was an internally used module for Persistent that I decided after the
fact to release separately.

As for Bryan's resource-pool: currently I would strongly recommend
*against* using it for any purpose. It is based on
MonadCatchIO-transformers[2], which is a subtly broken package. In
particular, when I tried using it for pool/persistent in the first
place, I ended up with double-free bugs from SQLite. As an abridged
history, I ended up writing a replacement called MonadInvertIO, which
later was superceded by MonadPeelIO[3] and MonadControlIO[4]. The
latter two packages are both much more correct that MonadCatchIO, and
either one should be used in its place.

I did email Bryan about this a bit ago, but he didn't get back (he
*is* a very busy guy). Ideally, I think that we don't need to have
both pool and resource-pool, but such is the situation right now.

Michael

[1] http://hackage.haskell.org/package/pool-0.1.0.3
[2] http://hackage.haskell.org/package/MonadCatchIO-transformers-0.2.2.2
[3] http://hackage.haskell.org/package/monad-peel
[4] http://hackage.haskell.org/package/monad-control-0.2.0.1

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to