[Haskell-cafe] Extending the idea of a general Num to other types?
Jonathan Cast
jcast at ou.edu
Tue Sep 4 17:38:04 EDT 2007
On Tue, 2007-09-04 at 23:03 +0200, Peter Verswyvelen wrote:
> Jonathan Cast wrote:
> > I don't think this has been mentioned explicitly yet, but the
> > discrepancy is purely for pedagogical purposes.
> >
> > In Gofer, list comprehensions (and list syntax, IIRC) /was/ generalized
> > (to an arbitrary instance of MonadPlus). But that means that any
> > mistake in your syntax likely brings up a type error mentioning
> > MonadPlus. This confuses CS freshmen (who are easily confused anyway);
> > thus, Haskell restricts list syntax to lists so the type errors are
> > simpler.
> >
> > By contrast, most CS freshman have already used languages with multiple
> > number types, so all you have to do is explain that type errors
> > involving Num are Haskell's way of dealing with them. So the syntax can
> > be generalized to the type class in that case without confusing freshmen
> > as much.
> >
> > jcc
> >
> >
> Well, that is a very good reason, but for newbies (or should I say, for
> me ;-) ), most error messages are very confusing anyway! An since
> Haskell is really an advanced language, why not go all the way? It feels
> to me that for learning FP to newbies, a small subset of Haskell would
> be more suitable to get started, so really easy error messages can be
> given (Helium does that already?)
Exactly. But the Haskell 98 standard pre-dates Helium. I think
Haskell' could be made more complicated now that Helium exists, but
don't know whether that's in the cards.
> Otherwise you would need a very clever
> compiler/editor machine learning system, that looks at how a class of
> users fixes a certain error, so the compiler can adapt its error message
> the next time a similar pattern occurs (which is science fiction right
> now I think...)
GHC I think tries to mediate this through the minds of its developers.
> Now, these complex error messages are not just for Haskell; when I did
> complicated C++ template programming, the error message sometimes became
> as long as a full page when printed, and it took me more time to
> decipher the error than to fix the code ;-)
>
> PS: Gofer, is that an existing language? As far as some googling can
> tell me, it's dead?
Right. Gofer died the quick death of most research languages, although
it influence Hugs.
jcc
More information about the Haskell-Cafe
mailing list