[Haskell-beginners] Haskell described as a "rigid" language
Stephen Blackheath [to Haskell-Beginners]
mutilating.cauliflowers.stephen at blacksapphire.com
Mon May 17 22:26:45 EDT 2010
I have been programming in imperative languages for 20+ years and
Haskell for about 2 years, and I've written a lot of it. I've never
found Haskell restricting. Twice I have decided that a dynamic type was
needed, and in many cases I've used object-oriented approaches in
Haskell where it makes sense. This is actually fairy often. One
example is a web widgets library where each widget had different
'render', 'parse', etc methods.
Doing OO in Haskell isn't hard at all, in my opinion. You just use a
data structure of functions. If you want it to have mutable state, you
use an IORef (but it really isn't necessary). It's more typing than
usual Haskell, but it still beats Java. Python would be more succinct
I've also written things very imperatively in IO, and found I could do
anything I liked.
I can think of some very small parts of programs where it might have
been a little easier in Java or Python, but not by much, and Haskell's
other advantages generally offset it.
On occasions I've realized that the design wasn't going to work, and I
needed to get some data from A to B. In other languages, you can use a
global variable or singleton (same thing). In Haskell it means a bit of
re-design. But the thing is, it's so easy to refactor in Haskell, that
the extra work doesn't matter much. Your code is already modular at
every level, so it's easy to move things around. When your code never
gets a chance to get messy, and the type system doesn't let you break
anything that previously worked, refactoring becomes a pleasure instead
of a chore.
So Haskell's inflexibility actually gives you the ability to rearrange
your program effortlessly. That is, you get a lot in return. I could
probably add that Haskell's inflexibility is determined by the types you
give things. You can restrict yourself as much or as little as you
like, but Haskell allows you to restrict yourself a lot more than other
On 18/05/10 12:22, aditya siram wrote:
> Haskell is considered by many as an inflexible language  . I
> describe a flexible language as one that supports any design you want
> (even a bad one) - if you can think it, you can code it and run it
> (bugs and all).
> I share this opinion about Haskell but pursue it because I feel that
> one day it will open up and let me think more about the problem and
> less about how to get GHC to approve it.
> So I guess the question to you practitioners is: Would you agree that
> it is a rigid language as describe in the link below, or is that just
> an illusion that goes away with experience?
>  http://therighttool.hammerprinciple.com/statements/this-language-has-a-very-rigid-idea-of-how-things-
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners