
8 Oct
2010
8 Oct
'10
3:18 p.m.
* Ben Franksen:
You might be interested in Lightweight Monadic Regions
http://okmij.org/ftp/Haskell/regions.html#light-weight
which solve the problem (IMHO) in a much cleaner way, i.e. w/o explicit closing and also w/o using finalizers.
Is this approach composeable in the sense that you can combine code written in this code with code from another library? I don't think so. The other library might provide something like IORef, and then it's impossible to uphold static guarantees. IMHO, this rules out such an approach (until it's part of the standard library and forced upon everyone, which seems unlikely).