[Haskell-cafe] The instability of Haskell libraries
mads.lindstroem at gmail.com
Sat Apr 24 05:36:04 EDT 2010
On Sat, 2010-04-24 at 19:25 +1000, Ivan Lazar Miljenovic wrote:
> Roman Leshchinskiy <rl at cse.unsw.edu.au> writes:
> > John Goerzen gave one in the very first post of this thread: the fix
> > to old-locale which didn't change any types but apparently changed the
> > behaviour of a function quite drastically. Another example would be a
> > change to the Ord instances for Float and Double which would have
> > compare raise an exception on NaNs as discussed in a different thread
> > on this list. Another one, which is admittedly silly but demonstrates
> > my point, would be changing the implementation of map to
> > map _ _ = 
> > In general, any significant tightening/changing of preconditions and
> > loosening/changing of postconditions would qualify.
> OK, fair enough, I see how these can be considered changing the API.
> Thing is, whilst it would be possible in general to have a tool that
> determines if the API has changed based upon type signatures, etc. how
> would you go about automating the test for detecting if the "intention"
> of a function changes in this manner?
You could automatically generate QuickCheck tests for many pure
functions. It will not catch every API change, but it would catch some.
It would have caught the API change that John mentioned.
But automatically generating QuickCheck tests to test if funOld ==
funNew, would require quite a bit work. But better than everybody having
to write unit tests, as other have proposed.
More information about the Haskell-Cafe