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

Neil Mitchell ndmitchell at gmail.com
Fri Nov 17 06:37:12 EST 2006


> > How controversial would a proposal to {-# DEPRECATE fromJust #-} be, in
> > favour of:
> >
> >     Just _ = x  -- which will give you the precise line number

> > It seems to me this is one cause of mysterious newbie errors we
> > could easily discourage, with little harm.
> Btw, I'm not seriously suggesting removing it ;)
> It could be discouraged ever so slightly in the haddocks though.

I strongly disagree. If we are removing things that confuse newbies
why not start with higher rank types, MPTC's and GADT's ;)

fromJust is simple, useful and clear. What you mean is that
implementations aren't very good at debugging this. It seems unfair to
blame partial functions for the lack of a debugger. If a call stack
was automatically output every time a fromJust failed would this even
be something people complained about?



More information about the Haskell-Cafe mailing list