[Haskell-cafe] Interesting new user perspective
andrewcoppin at btinternet.com
Thu Oct 9 16:33:43 EDT 2008
Don Stewart wrote:
> Has some good thoughts on what tripped him up in his first two weeks of
> Haskell programming. Anything people want to work on there? :-)
> Worth a read if you're thinking about how to make Haskell yet more
Sounds like it was written by somebody who's already used to languages
like Lisp and Python.
As I wrote a while earlier, I recently convinced an hardent C++
programmer to install GHC and start coding. Aside from the endless
stream of "minor" things that trip you over when learning any new
language, the biggest thing he sited as being difficult is the
"implicitness" of Haskell.
C++ is a very explicit language. If you want an integer variable, you
say "int x". If you want a vector of integers, you say "std::vector<int>
x". And so on. In Haskell, you just say "x" and you've got a variable.
Maybe it's type is known at compile-time. Maybe its type is
polymorphically determined by the caller. Maybe it's dynamically
changable at runtime (e.g., if you're using something like existential
quantification). And you can write entire Haskell programs with not a
single type signature in sight. (Until you grok how parametric
polymorphism and Haskell's non-traditional type syntax work, this is
probably the easiest way to program.) If you write a class instance, you
define a whole bunch of functions who's types are implicitly fixed by
the class definition [which could be somewhere very remote]. Define an
algebraic data type using record syntax and you just implicitly defined
half a dozen value constructors and projection functions.
In short, with a few lines of Haskell, you can do an awful lot of work,
and it can be a bit bewildering figuring out where all this "work" is
I for one actually *like* the implicitness of Haskell. It's what enables
you to write short, flexible, intuitive code. I think it's just the
teaching of the language that needs work, not so much the language itself.
That reminds me... I really must check out the draft of Real World
Haskell sometime soon!
More information about the Haskell-Cafe