[Haskell] ANNOUNCE: New versions of ALL the monadic regions packages
Bas van Dijk
v.dijk.bas at gmail.com
Thu Jan 7 10:00:31 EST 2010
As I explained in my announcement of 'safer-file-handles', I
discovered a serious lack of expressive power in my 'regions' package.
I have now solved that problem in the way I envisaged by removing the
'resource' parameter from 'RegionT' and using existential
quantification to bring the 'resource' type back at the place I need
it but hidden from the outside.
Now you're able to open multiple types of resources in a single region
which all will be closed automatically on termination of the region.
These are the new releases:
(Note that in the process I shuffled a bit with the API's. That's one
of the reasons all these are major releases.)
Do you want to see this in action? See 'example.hs' in the following
package that demonstrates opening multiple different types of
resources in a single region. The example extends the example in the
'usb-safe-examples' package by first opening a USB device (my USB
mouse) and a temporary file in the same region. Next the device is
configured, an interface is claimed and an alternate is set. Next some
bytes are read from an endpoint of the device. Finally these bytes are
written to the temporary file.
It's fun to see this in action so do try it out:
darcs get http://code.haskell.org/~basvandijk/code/usb-safe-and-safer-file-handles-examples/
regards and see some of you at FP-NL tomorrow!
More information about the Haskell