[Haskell-cafe] Re: Debugging partial functions by the rules

Ketil Malde ketil+haskell at ii.uib.no
Wed Nov 15 10:03:50 EST 2006

Lennart Augustsson <lennart at augustsson.net> writes:

> Should Haskell also provide unrestricted side effects, setjmp/
> longjmp, missile launching functions, etc?  After all, people who
> don't want to use them can just avoid them. :)


It is indeed a common problem that programs have unintended behavior,
and partial functions are only the tip of the iceberg.  We can keep
patching things up. For instance, 'head' can be made to never fail
simply by requiring all lists to be infinite. Similarly, fromJust can
be fixed by having 'data Maybe a = Just a', and doing away with
'Nothing', which is hardly useful for anything anyway.

But this is only superficial patchwork that glosses over the deeper
problem.  I therefore propose that all functions should either be of
type '() -> ()', or non-terminating.  That should avoid most error
messages, I think, and make it very easy to avoid any unintended
consequences - and the programmer is relieved of the burden of
actively avoiding dangerous stuff.

Is it possible to implement this for Haskell'?

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list