[Haskell] ANN: IOSpec 0.1
stefanor at cox.net
Tue Apr 24 19:51:14 EDT 2007
On Tue, Apr 24, 2007 at 07:36:07PM -0400, Isaac Dupree wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Wouter Swierstra wrote:
> > * If you're an ICFP referee, you may want to avoid reading any further*
> > Test.IOSpec Version 1.0
> > I'm pleased to announce the first release of the Test.IOSpec library,
> > that provides a pure specification of some functions in the IO monad.
> > This may be of interest to anyone who wants to debug, reason about,
> > analyse, or test impure code.
> > Essentially, by importing libraries from IOSpec you can the same code
> > you would normally write in the IO monad. Once you're satisfied that
> > your functions are reasonably well-behaved, you can remove the
> > Test.IOSpec import and replace it with the "real" functions instead.
> > Website: www.cs.nott.ac.uk/~wss/repos/IOSpec
> > Darcs: darcs get www.cs.nott.ac.uk/~wss/repos/IOSpec
> > Tarball: www.cs.nott.ac.uk/~wss/repos/IOSpec/dist/IOSpec-0.1.tar.gz
> > Haddock: www.cs.nott.ac.uk/~wss/repos/IOSpec/dist/doc/html
> > Several examples are included with the sources.
> > At the moment, the library consists of the following modules:
> > * Test.IOSpec.Teletype: a specification of getChar and putChar.
> > * Test.IOSpec.IORef: a specification of most functions on IORefs.
> > * Test.IOSpec.Concurrent: specification of forkIO and MVars.
> > As an added feature, running concurrent code using
> > Test.IOSpec.Concurrent will detect deadlocks, instead of looping
> > indefinitely.
> > Future work includes:
> > * Improving the interface, making it easier to combine functions from
> > different modules.
> > * Adding more functionality: STM and weak pointers seem likely
> > candidates.
> > If you have any questions, comments, or feedback, please do get in touch.
> > Wouter
> How does or might this relate to the typeclass-based Restricted IO monad
> ? RIO's technique has the advantage that multiple capabilities can be
> easily combined in one use of the monad - but this manner of using
> typeclasses might interfere with how testable it is? (I think that
> should be okay... Also that this is a really neat project - incremental
> progress on taming Haskell IO in practice!)
As I see it (NB: I wrote RIO) RIO and IOSpec solve very different
problems. RIO is all about embedding capabilities in the type system,
and allowing update-in-place with more flexibility than ST. In
contrast IOSpec seems to be the exact opposite - it provides an
IO-like interface to *im*mutable state.
Also note that RIO contains an slow, bug-ridden, ad-hoc, informally
specified implementation of half of HList.
Looks very neat, Wouter - I look forward to having an excuse to use it!
in the Teletype module, it would probably be better to reflect
IOTeletype operations as:
data Action a = Finish a | Put Char (Action a) | Get (Char -> Action a)
That way, there is no need to use (unobservable) laziness.
More information about the Haskell