[Haskell-cafe] Why is $ right associative instead
rjmh at cs.chalmers.se
Mon Feb 6 05:14:00 EST 2006
Cale Gibbard wrote:
>How about a compiler switch for beginners (maybe with an included
>script that adds it to the command line) that turns off a bunch of the
>more complex issues involved, and uses a beginner's version of the
Well, right now, the complex issues are turned off by having separate types
and separate functions, which works pretty well. Would such a switch
resolve overloading silently to "beginners' types"? If so, some code would
compile with the switch, but not without it--which is pretty scary. You'd
need to check when compiling each module whether it was "beginners"
>Functor really that hard? It's just container types with a way to
>apply a function to all of their elements. :)
>Also, it seems that classes are one of the first things one has to
>teach now anyway, as they're bound to come up in error messages in any
>actual programs you try to write. When teaching my friend, I taught
>the basics of classes along with types in the first and second lesson
>(including how to define them) and presented various values and
>functions as examples.
Something tells me your friend wasn't an undergraduate of only moderate
ability, with no programming experience of any kind. Honestly, the
between a singleton list and its element is a big deal at this
"container types" would go right over almost all students' heads. You're
that classes must be mentioned early, but there's no need for more than
basic understanding. I tell my students always to write type signatures
start, so the error messages they see say things like "No instance Num
I just tell them that means booleans aren't numbers--they don't need to even
see a class or instance definition to understand that.
I don't think it should be necessary to completely rule out useful
features because they might be difficult to newcomers. There should
always be ways to turn things off, and construct a simpler language
for new users. Dr. Scheme seems to take this approach, and has a
pretty fine gradation of languages for leading users from their first
steps into the finer points of Scheme.
It would be interesting to see a "Dr. Scheme" like approach to Haskell.
But there is a risk with that approach--namely, that students get the
impression (correctly) that they are learning a toy language which isn't
usable for real applications. That is a big-time motivation killer.
(I'm not criticizing Dr Scheme here, but rather how I imagine a flag
of the sort we're discussing might work with Haskell). It's important
that there is a smooth route to infinity and beyond, so one can show
students cool stuff like wxHaskell without discontinuities along the way.
Otherwise they're just glad to finish their Haskell course, and move
on to a real programming language like Java.
Separate syntax for easy and more difficult concepts--separating
comprehensions from do--does provide a very smooth progression for
More information about the Haskell-Cafe