[Haskell-cafe] ANNOUNCE: New versions of ALL the monadic regions packages

Felipe Lessa felipe.lessa at gmail.com
Thu Jan 7 21:03:45 EST 2010

On Thu, Jan 07, 2010 at 08:39:59PM +0100, Bas van Dijk wrote:
> Another solution might be to encode the resources that a region opens
> as constraints. I think 'control-monad-exception' uses a similar
> technique to encode all the exceptions that a monadic computation may
> throw.

Yes, yes, that's what I had in mind, thanks for bringing it up.
Although it isn't exatcly beautiful, GHC can infer the types and
it works.

> My previous program could then possibly be written as something like:
> openBoth ∷ ( resources `Contains` Device
>            , resources `Contains` File
>            )
>          ⇒ Device → FilePath → RegionT resources pr ()
> openBoth usbDevice filePath = do
>  h1 ← open usbDevice
>  h2 ← openFile filePath ReadMode
>  return ()

I just don't see yet (maybe because I'm not well versed in
monadic regions) how runRegionT will work.  When working with
exceptions, I have to provide a datatype that implements all the
type classes I've used in my program.

Hmmm...  Perhaps an internal data type that is exposed and other
modules instantiate?



More information about the Haskell-Cafe mailing list