From a newbie
Greetings. I am a Haskell newbie. I am writing this page because I couldn't think of any other way to get attention. (More on this below.) Maybe somebody will see this page and add some useful comments. Maybe this page will simply be deleted. I don't know…
2 First impressions of Haskell
For some background... I first starting programming with BASIC, way back in the Dark Ages of 8-bit home computers. I then moved on to raw machine code (couldn't afford an assembler). From there I went on to Pascal — which I found much to my liking. Later I learned about Smalltalk and Java. (Java — Nice idea, shame it's a crock of junk…)
Then I learned Haskell. Presumably it goes without saying that it was a mind-bending experience. (!) Much like learning OOP — but more intense! Haskell is utterly unlike anything I have ever seen before… and I think I like it!
3 The trouble with Haskell
Sadly, it turns out that Haskell appears to have 2 fatal problems. (Which is really what I'm writing this page for.)
3.1 The first problem
It seems to be that virtually all programming languages can be neatly seperated into two disjoint categories:
- First there are type-I languages. Surely C is the apex of what it is to be a type-I language. C is ugly, complex, low-level, poorly defined, dangerous, extremely hard to read, and actually impossible to write. In short, C is a disgusting language which should never ever have been invented in the first place. But you can do stuff in C.
- And then there are the type-II languages. Things like Smalltalk, Eiffel, etc. Languages which are simple, flexible, powerful, elligant, beautiful. Languages with are a sheer joy to program with. Unfortunately, you cannot do stuff with type-II languages.
If Eiffel is “powerful” then Haskell is surely some kind of weapon of mass destruction! Regrettably, it seems that Haskell is yet another type-II language. Inside Haskell you can write some amazing stuff. But you just can't talk to the outside world. No graphics, no sound, no GUI, no networking, no database access, no compression, no cryptography, no threading… the list just goes on and on.
- Huh? Graphics, GUI, networking, threading, and compression are all very well supported.
- Dunno about cryptography, sound is irrelevant because hearing is better reserved for detecting disk crashes :)
- Check Graphics.Rendering.OpenGL, Graphics.UI.Gtk, Network, Control.Concurrent, and Codec.Compression.GZip respectively.
- Stefan 23:48, 10 January 2007 (UTC)
- Graphics. Well, until recently, the library page had a note on it saying "HGL is currently broken on Win32". Other than that... OpenGL. Yeah, sure. I'm going to learn OpenGL just so that I can write a few pixels to the screen. (No, seriously. It's lovely that it's there if I want it. But it's a hell of a lot to learn just to draw individual pixels - which is all I want.) Also, you still need to somehow open a window first.
- Graphics.UI.Gtk - Uh... where the heck is that? I don't see it documented anywhere...
- Codec.Compression.GZip - ditto.
- Networking, at least, does appear to work.
- Control.Concurrent - Quoting the documentation for that very module: "Scheduling of Haskell threads is done internally in the Haskell runtime system, and doesn't make use of any operating system-supplied thread packages." So my dual-core CPU is still going to sit half-utilised.
- MathematicalOrchid 13:04, 17 January 2007 (UTC)
Do you have any idea how frustrating it is to have found such a supremely powerful programming language and yet have utterly no way of using it?!
Also, in common with many type-II languages, I find the language itself works, but everything else around it is lacking. Tools don't work well. Libraries are sparse. Everything is fairly poorly documented. It just makes life harder. (I could name any number of standard modules right now that have virtually no documentation beyond function names and type signatures.)
3.2 The second problem
The other problem is the Haskell community — or rather, the total non-existence of such. There are no web forums, no NTTP server, nothing. Nowhere a newbie like me can ask questions. I've had to resort to creating an orphan Wiki page just to say want I wish to be heard. This isn't an efficient way to communicate.
I understand there is an email list, but SMTP is really not well suited to large group discussions. NNTP works much better for that. (Assuming you have a client and know how to use it. Web forums are generally a better idea.)
- A wiki page is infinitely worse than SMTP for large group discussions, and I speak from (this) experience. Stefan 23:48, 10 January 2007 (UTC)
- Yeah, I have to agree with that one... MathematicalOrchid 13:04, 17 January 2007 (UTC)
Oh, there is the Haskell IRC channel. Boy, that was a hoot! I've been on IRC channels with 6 people that are so busy you can't tell who's talking to who. But the Haskell IRC channel was something else… Over 300 people connected, and nobody speaking! Every 20 minutes or so, somebody would ask a question or something. They were all greeted by utter silence.
- You must have arrived at the wrong time ... we have ~20 active users and many bursts of activity, with silence in between, check back soon and people will help. (at least if you return in the 6 hrs before my curfew) Stefan 23:48, 10 January 2007 (UTC)
Extremely amusing, but not especially helpful.
So it is that I am left with half a dozen “getting started” tutorials scattered over the Internet, plus the Language Report. The Language Report of course is a reference document. And very unfriendly it is too. Oh, and there's the library docs — highly incomplete as they are.
All of this is really quite dissappointing. I actually have several questions I'd like answers to, but I can't find anywhere to ask.
4 In closing
Oh well, since I'm here I suppose I might as well ask a few actual questions rather than just looking like I'm here to flame everything.
- Why does every non-trivial program or library require language extensions. Seriously. What the hell? Is plain Haskell 98 such a feeble language that no interesting software can be written with it? If so, that doesn't bode well! (For example, I tried to use the module Control.Monad.State. However, instead of importing the module I merely got a fairly opaque error message basically telling me I need to enable extensions. Why? It's perfectly possible to write a state monad in plain Haskell. So why do the standard modules not to this??)
- Actually, the problem is that you are using Hugs. Since some people use language extensions, Control.Monad.State uses them itself to "play nicer" with modules that use extensions. GHCi supports encapsulation of language use, so you need not know or care what extensions the libraries use. GHCi also has much better error messages, and is much more actively maintained. Stefan 23:48, 10 January 2007 (UTC)
- Why must language extensions exist at all? Why can't everybody just use Haskell 98? MathematicalOrchid 13:04, 17 January 2007 (UTC)
- Why is it that Haskell seems to attract people who casually throw around phrases like “existential qualification” as if they mean something? Seriously. All programming languages have their own special terms, and in some cases stuff doesn't really make sense until you learn these. (For example, in OOP people debate whether “inheritance breaks encapsulation” or that “inheritance is overused and collaboration is underused”.) But Haskell seems to attract utterly bizzare terms vastly more than any other language I've ever seen! Why is that?
- Haskell is written by mathematicians, and most of the terms are perfectly meaningful terms borrowed from incredibly arcane fields. (category theory mostly.) Not like it makes a difference. Stefan 23:48, 10 January 2007 (UTC)
- Is there any way to make is to that making a type an instance of class X automatically makes it an instance of class Y? I'm getting really tired of cut-and-pasting identical instance definitions…
- No. Stefan 23:48, 10 January 2007 (UTC)
- When I read about 'lines' and 'words', I was expecting them to by curried versions of some more general function. However, it appears that no such general function exists. Why?
split_with :: (Eq t) => t -> [t] -> t split_with ":" "5:11:21" == ["5","11","21"]
- It's not hard!
- Hint: google. That problem has been discussed innumerable times. Stefan 23:48, 10 January 2007 (UTC)
- Does anybody have a good explanation of the seemingly arbitrary and random distribution of numerical types and classes? I'm sure I'm not the only person confused by this…
- Ditto. Stefan 23:48, 10 January 2007 (UTC)
- Is there any way I can make it so that 'Complex' means 'Data.Complex.Complex Predule.Double'? I have tried and tried and tried to make this work; Hugs isn't having any of it.
- GHCi will let you say :m + Data.Complex and then Complex Double. If you use a file, you can say 'type X = Complex Double'.
- But what it won't let me do of course is 'type Complex = Complex Double'... (Or anything remotely similar.) MathematicalOrchid 13:04, 17 January 2007 (UTC)
- You know that the latest release of Hugs is horribly unstable, right? I mean, I used the Nov 2003 version for a long time, without issue. But the new Sep 2006 version behaves very unpredictably. It has a habit of truncating output, reprinting bits of previous output (the intro banner is especially popular), and frequently just stopping with a Dr Watson error. What the hell…?
- Does anybody know what 'seq' actually does? The Prelude documentation is a fleeting comment about “avoiding unnecessary laziness”, but presumably an entire book could be written on such a subject. Where is this book?
- No, nobody does. Stefan 23:48, 10 January 2007 (UTC)
If anybody has anything useful to say, please add it to the bottom of this page.
- Since you didn't use SMTP, I have been forced to choose between attribution and context. The latter seemed more helpful. Stefan 23:48, 10 January 2007 (UTC)
MathematicalOrchid 21:31, 10 January 2007 (UTC)