
hmmm .. Jeremy ....
http://notes-on-haskell.blogspot.com/2007/03/design-patterns-in-haskell-brac.......
thx,
vasili
On Wed, Aug 6, 2008 at 2:25 AM, Jeremy Shaw
At Wed, 6 Aug 2008 00:43:55 -0500, Galchin, Vasili wrote:
[1
] [1.1 ] Hello, 1) Is there a common assumed semantics across all of the Haskell
"with"
things? withString? withData?
A vague semantic is that some resource is acquired, used, and then released.
2) If the answer to 1) is yes, then does this imply some kind of polymorphism? Couldn't "with" be "reduced" to a higher order function
then
??
I think Control.Exception.bracket is used to implement many, but not all, of the with* functions.
newThing :: IO a newThing = ...
destroyThing :: a -> IO b destroyThing ...
withThing :: (Thing -> IO a) -> IO a withThing useThing = bracket newThing destroyThing useThing
I have not fully answered either of your questions, but hopefully this is a start.
j.