
I'd like to be able to reorganize my code and then verify that I didn't change any functionality. That is, the old and new code have precisely the same meaning. Also, I'd like to be able to change a function and verify that efficiency was the only thing affected. Are either of these possible in Haskell or any language? Thanks, Greg

Hi
I'd like to be able to reorganize my code and then verify that I didn't change any functionality. That is, the old and new code have precisely the same meaning.
Also, I'd like to be able to change a function and verify that efficiency was the only thing affected.
Are either of these possible in Haskell or any language?
They are possible in any language, just in some they might have a lot of work to do the proofs. In Haskell they are pretty easy: http://haskell.org/haskellwiki/Haskell_Equational_Reasoning_Assistant (More one function at a time, not publically available, as far as I can tell) http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html (Global refactorings, a nice tool) Thanks Neil

Greg Fitzgerald on 2006-12-12 11:24:58 -0800:
I'd like to be able to reorganize my code and then verify that I didn't change any functionality. That is, the old and new code have precisely the same meaning.
Also, I'd like to be able to change a function and verify that efficiency was the only thing affected.
Are either of these possible in Haskell or any language?
Use QuickCheck to generate parameters and compare return values for the old and the new functions.

On 12/12/2006, at 20:31, Alec Berryman wrote:
Greg Fitzgerald on 2006-12-12 11:24:58 -0800:
I'd like to be able to reorganize my code and then verify that I didn't change any functionality. That is, the old and new code have precisely the same meaning.
Also, I'd like to be able to change a function and verify that efficiency was the only thing affected.
Are either of these possible in Haskell or any language?
Use QuickCheck to generate parameters and compare return values for the old and the new functions.
That is a great suggestion which works extremely well in my experience, but only for the second of Greg's requests. In the first case you don't need the additional validation, and probably you don't want to keep your unrefactored code around.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi, Am Dienstag, den 12.12.2006, 11:24 -0800 schrieb Greg Fitzgerald:
I'd like to be able to reorganize my code and then verify that I didn't change any functionality. That is, the old and new code have precisely the same meaning.
Also, I'd like to be able to change a function and verify that efficiency was the only thing affected.
Are either of these possible in Haskell or any language?
Yes, just create an instance (Eq a, Eq b) => Eq (a -> b) then you can use == to compare your definitions. Sorry, could not resist, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189
participants (5)
-
Alec Berryman
-
Greg Fitzgerald
-
Joachim Breitner
-
Neil Mitchell
-
Pepe Iborra