[Haskell-cafe] Db and STRef

Brandon Moore brandonm at yahoo-inc.com
Sun Jan 15 13:50:18 EST 2006


John Goerzen wrote:
...
> I didn't honestly follow the STRef discussion, or how something so
> I/O-based could work there.
> 
> -- John

The only message I've found was Oleg mentioning the typing that keeps
an STRef limited to the scope of the runST it came from.

I don't think database access could live in ST either.
I think the proposal was to build something like Oleg's Monadic Regions
http://okmij.org/ftp/Haskell/types.html#monadic-regions
on top of IO

I'm assuming you understand how the type on runST and the STRef
operations ensure that, even though you *can* smuggle out an STRef in
the result from runST, you will never be able to use it again.

The idea was to do the equivalent thing with databases: use fancy types
to ensure that handle can only be used inside to origination withDB or
withCursor or whatever, and the bracketing function can release the
resource on the way out, without worrying about it being used again.

Brandon

> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell




More information about the Haskell-Cafe mailing list