[Haskell-cafe] Re: [Haskell-beginners] Just how unsafe is unsafe

Roel van Dijk vandijk.roel at gmail.com
Fri Feb 6 13:25:18 EST 2009

> 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.

More information about the Beginners mailing list