[Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

Gregory Crosswhite gcrosswhite at gmail.com
Tue Dec 20 12:43:18 CET 2011


On Dec 20, 2011, at 9:18 PM, Jesse Schalken wrote:

> Why do you have to solve the halting problem?

You have to solve the halting problem if you want to replace every place where _|_ could occur with an Error monad (or something similar), because _|_ includes occasions when functions will never terminate.

> Consider integer division by 0.  [...]
> This is all I was talking about.

But imagine there was an occasion where you *knew* that the divisor was never zero --- say, because the divisor was constructed to be a natural number.  Now there is no point in running in the Error monad because there will never such a runtime error;  in fact, it is not clear what you would even *do* with a Left value anyway, short of terminating the program and printing and error, which is what would have happened anyway.  Furthermore, it is easy to imagine circumstances where you have now forced your entire program to run in the Error monad, which makes everything incredibly inconvenient with no benefit at all.

This is the problem with arguments against partial functions;  they don't solve any problems at all except in the case where you have untrusted data in which case you should be using a different function or manually checking it anyway, and they add a lot of wasted overhead.

Cheers,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111220/c2705d7f/attachment.htm>


More information about the Haskell-Cafe mailing list