I need help staying motivated in my study of Haskell

Submitted by metaperl on Fri, 05/27/2005 - 7:16am.

I have been a professional Perl programmer for 5 years. Perl5 is a wonderfully agile language. It was very odd that I would discover Haskell independantly right around the same time as Autrijus did.

Having stared at Perl6 and given 3 talks on it, I am convinced that it is a big confused mess. A BIG confused mess. I don't think it will be eagerly accepted and many people are going to stay with perl5 or find another language.

I want to go to the heart of computing. I am very impressed with Haskell for every reason that you could be. I worry that it is only 1/2 as fast as OCaml, but I demand to work in a pure functional language. While most people are very open-minded about languages, I am not. I am passionate and religious about whatever I involve myself in and I only get involved with what I think is right, not what is popular.

I have to get out of Perl while the getting is good. C++ holds some attraction for me. Much larger libraries than Haskell. Class-based programming with typing. Many apps are delivered in C++. This web browser I am using is probably written in it. My IRC client is C++-based. My chess database is as well... hmm wait a minute. I think I will look at C++ closer.

But anyway, I had been studying Haskell every day after work and then I got stressed and tensed and started avoiding. I need some way to sit down in front of my computer and study Haskell whether I like it or not. But until I get C++ out of my head, I am still a case of a divided mind.

More later...

Submitted by metaperl on Fri, 05/27/2005 - 7:49am.

Hmm, C++ looks like the next step from Perl5. It has objects and state but it is faster than Perl5.

A big language but perhaps that is necessary to deal with corporate concerns.

Some people know both C++ and Haskell.

Confused and searching, over and out.

Submitted by jgoerzen on Fri, 05/27/2005 - 7:56am.

You could be right about Haskell being half as fast as OCaml. But then again, Perl 5 and Python are also half as fast as OCaml, and Java fares even worse. So while Haskell performance is not so stellar that it ranks up there with C, it also is by no means an outlier. It seems to be pretty much a middle of the pack performer to me.

Due to Haskell's fully-lazy nature, bottlenecks tend to be in different places than most of us are accustomed to, and solutions are different. I'm just starting to learn about this myself.

The attraction of Haskell, to me, is that it takes less code to make wonderful things happen than with any other language I've ever used.

C++ is not that great of a language, IMHO. It suffers from over-complexity in so many ways (for instance, more ways to pass variables than necessary). Java has a similar problem, but in a different place (its standard libraries).

Plus, you will miss things like type inference, type classes, lazy lists, etc. that you get with Haskell.

You are also correct about the size of the Haskell library being small. That's something I'm working to fix. You're welcome to contribute to MissingH; there is a darcs repository for it. You can also use MissingPy; it has a generic interface to Python. Python has a quite large library, and you can interface with it fairly easily with MissingPy. And, of course, FFI makes it amazingly easy to work with C libraries from Haskell as well. It's probably the easiest of any of (Perl, Java, or Python) that I've used.

My approach to learning a language is this: once I've decided I want to learn a language, I write absolutely everything I possibly can in it. Any programming problem gets solved in this new language.

It's a great way to learn about both the strengths and weaknesses of a language.

Submitted by gour on Sat, 05/28/2005 - 12:30am.

And, of course, FFI makes it amazingly easy to work with C libraries from Haskell as well. It's probably the easiest of any of (Perl, Java, or Python) that I've used.

That's what I think too, i.e. use Haskell as general programming language allowing one to solve problems on the higher level, and use C libs when speed and/or extra functionality is missing.

What is your favorite tool for FFI (if you do not write everything by hand) ?

I like c2hs and hope that soon it will be fixed allowing bigger libs (eg. gtk2hs) to be processed with 'normal' amounts of RAM :-)

My approach to learning a language is this: once I've decided I want to learn a language, I write absolutely everything I possibly can in it. Any programming problem gets solved in this new language.

This is a good tip.

It's a great way to learn about both the strengths and weaknesses of a language.

What would you consider main weaknesses of Haskell?

Sincerely,
Gour

Submitted by jgoerzen on Sat, 05/28/2005 - 6:37am.

What is your favorite tool for FFI (if you do not write everything by hand) ?

So far, I've used FFI by hand. I've had a limited number of functions I need to import, as opposed to a whole library's worth of thousands, so it was easiest to just do it this way. For use in this way, FFI was easy and Just Worked.

What would you consider main weaknesses of Haskell?

There are two: breadth of libraries available and accessible documentation.

By breadth of libraries, I mean modules to do things like speak to SMTP servers, compress files, use an ncurses interface, etc. Things that Python comes with or Perl has in CPAN. Some of these are "done" in some app, and so converting them to a library is trivial. Some are easy-to-use C apps, so using them with FFI is trivial as well. But they're not packaged up in a nice, convenient way.

There are some nice libraries, though. hsql, for instance, is a polished database interface. I'm trying to keep a library full of pure Haskell code in MissingH, and via MissingPy, one can tap into Python's extensive collection of modules fairly easily. So I don't think this is terminal, and is being worked on, and will be fixed.

By accessible documentation, I mean documentation that can be read, understood, and applied to real problems without requiring an advanced degree in computer science. There is a lot of material out there about the theory behind different bits of Haskell, but compared to other languages, little the explains these things in practical terms, and applies them to real everyday problems. Haskell: The Craft of Functional Programming, 2nd Ed. is a printed book that does accomplish this. But we need more online coverage, as well as better documentation in the library reference.

Some people believe that Haskell is weak with I/O or that I/O in Haskell is difficult. I disagree. I believe that I/O (and more generally, monads) in Haskell is severly under-documented, but that overall, it is a very nice system. It has isolated pockets of weakness (Unicode and the performance implications of a 32-bit Char spring to mind), but overall, it is nice.

Submitted by metaperl on Fri, 05/27/2005 - 8:59am.

actually I think the strongest motivation for rolling up my sleeves and getting down to work with haskell is my post right here:

"Haskell puts the complexity of programming in the right place"

Submitted by metaperl on Fri, 05/27/2005 - 6:34pm.

Why Haskell Matters is another strong motivator for Haskell. Especially that quicksort program.

Submitted by itkovian on Fri, 06/03/2005 - 1:49am.

Well, I think the C++ code for that quicksort thingie is a tad bloated too. Especially considering one usually sorts in-place in such a programming environment. It seems to me that the copying is done to have a better comparison to the filtering in Haskell, but is is quite unecessary. Quicksort is a fragile algorithm, in the sens that if it isn't programmed well, it may take more resources than one might expect from a theoretical pov. The pivotal element at least should be chosen in a random manner, or a good approach is to take the first, last and center and use the middle value.

I understood the C++ code immediately. Furthermore, I'd say it's more C-like than C++-like, which has nifty template like things to factor out source code complexity.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.