[Haskell-cafe] the Haskell "with" "pattern"?

Jules Bean jules at jellybean.co.uk
Wed Aug 6 11:44:52 EDT 2008

Johan Tibell wrote:
> 2008/8/6 Galchin, Vasili <vigalchin at gmail.com>:
>> Hello,
>>     1) Is there a common assumed semantics across all of the Haskell "with"
>> things? withString? withData?
> You probably knew this already but there's nothing in the "with idiom"
> that prevents the resource to escape.

And, it doesn't always matter. Some withs are more unsafe that others :)

if the 'with' constructs a nice ordinary heap allocated haskell 
structure from the external resource then it may not matter one jot if 
it escapes: it may be out-of-date, perhaps, but still a useful data value.

On the other hand sometimes it does matter....

 > Oleg recently wrote about
> (lightweight) monadic regions and how they can statically assure that
> this doesn't happen.

Which is clever.

More information about the Haskell-Cafe mailing list