[Haskell-beginners] Haskell described as a "rigid" language
edgar.klerks at gmail.com
Tue May 18 05:00:26 EDT 2010
I am also a beginner in Haskell (6 months now) and I must say Haskell is
anything but restrictive to me. It let me create my own operators. It lets
met define polymorphic functions. I can use dynamic features, if I want, but
don't need to. I can even program imperative style, when I need it. But it
is seldom necessary. Sometimes for performance. It is relative easy to
design my own (embedded) language. One of the most flexible and powerful
design pattern there is. With record syntax I can change haskell in a OO
language. With monads I can make it into an imperative language. My first
haskell program was written in an imperative style.
At first I hated the typesystem, I think people refer to that. But now I
sometimes using haskell for my work and it saves me a lot of time. And it
explains what functions do. *Haskell is difficult to write, but easy to
read. While php is easy to write, but difficult to read.* I miss those
features in php. I even tried to invent an typesystem in php by creating
classes for all kind of types, but it was too slow (unfortunately). Maybe
there are better ways. I wrote an interface with Text.Json to PHP and pipes,
so I can communicate between the two. This works reasonable. If I shoot
myself in the foot at the php side, haskell mostly wont accept it.
And I love all those structures from category theory. At first it was really
difficult to use (I have a experimental physics background, so I haven't met
them in my study), but now I am really missing them in other languages,
because they actually provide flexibility and reusability. I can write
functions, which work on all functors due to polymorphism.
On the down side some things are difficult. Lazyness has still some strange
black magic feel to it. Especially space leaks, which are quite easily
detected by the profiler, but are quite annoying. It is useful, but
difficult to reason about. I am still struggling sometimes with arrays,
every time I use them I have to look them up. But that is probably because
it isn't really natural to the language. Data.Map is often a good
alternative for most goals.
So I wouldn't say haskell is particularly rigid. Well it is in its
typesystem and the way it handles side effects. But I don't see a
disadvantage in that. It catches bugs. I have never be affraid that some
unknown lib suddenly returns a string instead of a integer. But I have to
say at first I found haskell had a rigid feel over it, but that was because
I had to unlearn my imperative thought patterns. The two paradigms clashed
in my mind. The rigidity emerged from the fact that I couldn't do stuff the
way I was used too.
With kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners