
6 Feb
2009
6 Feb
'09
1:25 p.m.
Do you document the preconditions? Yes. The 'safe' variants of those functions have all preconditions listed in the accompanying (haddock) comments. The 'unsafe' variants simply state that they promote exceptions to errors.
It seems to me that this is more useful than naming a function unsafeXXX. Well, I do both :-) They are called unsafeXXX and they state why they are unsafe.
I was using comments to document the contracts on my functions, but I have just found about about ESC/Haskell, so I am now using the contract notation of that (not yet released) tool.
See http://www.cl.cam.ac.uk/~nx200/ That is interesting. I like formal proofs and preconditions better than informal ones.