Talk:Haskell (programming language)/Archive 1

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Eager evaluation

1What's meant by an "eager" variation? I worked with functional languages for some amount of time and never heard the term. --Robert Merkel

I'm pretty sure it means "without lazy evaluation". --Anon.
That's right. --The Anome
Basic Lambda Calculus theory... Just read some. Eager means you are always reducing the rightmost redex. The other "simple" option (more complex options are what Explicit Substitution Calculi studies) is to always reduce the leftmost redex. This second option is guaranteed to always reduce to a Normal Form if it exists (the eager doesnt guarantee this). Lazy is a refinement of the second option where you store pointers to redexes that eventually get copied around. -- Anon —Preceding unsigned comment added by (talk) 20:55, 14 November 2007 (UTC)


"Haskell is, as of 2002, the functional language on which the most research is being performed."

Do you have a reference for this statement? --Taw

"It is one of the more popular functional languages"

Likewise for this unreferenced claim. —The preceding unsigned comment was added by (talk) 00:08, 13 April 2007 (UTC).

Is it okay to remove this blatant lie? Nobody uses haskell, and this reference hardly has any relation to "the most research is being performed" 16:01, 22 July 2007 (UTC)

A survey of recent literature shows that Haskell syntax is widely used in functional programming research, but it is doubtful that there exists a reference that actually justifies that it is 'most used'. —Preceding unsigned comment added by (talk) 20:59, 30 October 2007 (UTC)
Um... That "Nobody uses Haskell" is a blatant lie. DiscipleRaynes (talk) 06:03, 28 January 2009 (UTC)

Page move

"Haskell" can also refer to, so I'm not moving this page to Haskell. --Eloquence 16:55 Jan 24, 2003 (UTC)

Code example

Not sure about the new version of the Fibonacci sequence example — it's longer than the first one and harder to read IMHO (although it is clever, I admit). Any comments on this? --Cadr

Which one? --Taku 16:14, Apr 6, 2004 (UTC)
The one using zipWith --Cadr
I see this change:
fibs = 0 : 1 : (zipWith (+) fibs (tail fibs))
fibs@(_:rest) = 0 : 1 : (zipWith (+) fibs rest)
--Taku 16:36, Apr 6, 2004 (UTC)
Yes, that's the one I meant, thanks. --Cadr

I got the idea: can we present both versions on the article and discuss how they work. To be honest, I don't know how the second one works and I want to know why you said it's a clever way. The readers might be fascinated by the fact Haskell is so cool. --Taku 16:52, Apr 6, 2004 (UTC)

Should we do that then? There's a whole bunch of example code in the article but no explanation of what it's doing, or what it results in. For example, the fibs line above results in an infinite (lazy) list of Fibonacci numbers, something that I think would be interesting to point out. Also, we might consider using this version (which I prefer):
fib@(_:tfib) = 1 : 1 : [ (a+b) | (a,b) <- zip fib tfib ]
It demonstrates list comprehension, simple use of the zip function from the Prelude, and is achingly elegant IMO!

Type inference

Should this article mention Hindley-Milner type inference and the monomorphism restriction? Or is this too detailed information to be included into a encyclopedic article? --Tobias Bergemann 08:30, 2004 Nov 16 (UTC)

.NET information deletion

Why the deletion of the 'extensions' section on Hugs98 for .NET? I can't immediately see why it'd be problematic. (And there no rationale provided.) --Alai 19:36, 19 Jan 2005 (UTC)

Literate mode

On the literate programming page, someone mentioned Haskell as a language that "makes full use of literate programming". As pointed out in the Talk page there, that is not how I remember Haskell, but I'd appreciate if someone could clarify things there. --Ar 17:08, 2005 Feb 7 (UTC)

I can't check at the moment, but I seem to recall the GHC docs mentioning literate programming. I think it has a facility for that as well as it's C-related stuff. -- 00:36, 23 July 2005 (UTC)
The revised Haskell 98 standard document, "Haskell 98 language and libraries: the Revised Report" (2002) contains a section on literate programming. Quoting from Section 9.4 Literate Comments:
"The "literate comment" convention, first developed by Richard Bird and Philip Wadler for Orwell, and inspired in turn by Donald Knuth's "literate programming", is an alternative style for encoding Haskell source code. The literate style encourages comments by making them the default. A line in which ">" is the first character is treated as part of the program; all other lines are comment."
"By convention, the style of comment is indicated by the file extension, with ".hs" indicating a usual Haskell file and ".lhs" indicating a literate Haskell file."
I don't know if this section was already part of the original Haskell 98 standard. I am not sure if and how this should be incorporated into the Haskell entry. --Tobias Bergemann 07:55, 23 July 2005 (UTC)

Lambda calculus syntax

"The '.' in the above is the '.' from Lambda calculus, a core part of functional programming."

Not at all, as far as I know, and not according to our article on Lambda calculus. In Lambda calculus, '.' is used as a syntactic element in lambda abstractions. In Haskell (prelude), f . g = \ x -> f (g x), that is function composition like the "circle operator" in mathematical analysis. --Anon.

Code examples

I decided to clean up the examples section a bit, which I have now done. The factorial function now has a proper type declaration (best to do these things right...) and a line-by-line explanation.

It's been mentioned previously about explaining the methods behind some of the more involved examples shown (particularly, why the linear-time Fib sequence is so elegant). I'm not sure we should turn Wikipedia into another Haskell tutorial, but if anyone knows places off-site which explain how they work, that would be good. Opinions, anyone?

--Ithika (not yet got account) 16:59, 4 September 2005 (UTC)

I hope you don't mind the small tweaks I made to the function definition. --TuukkaH 17:30:29, 2005-09-04 (UTC)
The RPN example is indeed elegant, but probably not all that helpful to somebody trying to work out what's good and bad about Haskell --Alang

Factorial function

Since we already use the factorial function as an example, should we also link to "The Evolution of a Haskell Programmer", which provides 20+ increasingly elaborate implementations of this same function? --Tobias Bergemann 08:36, 20 October 2005 (UTC)

Re the fac example, I'm an Haskell novice, but it seems to me that the guard expression in

fac :: Integer -> Integer
fac 0 = 1
fac n | n > 0 = n *fac (n-1)

serves no purpose? The zero case is handled and the only other possibility is n<0 which isn't checked for anyway...could you not replace with the following?

fac :: Integer -> Integer
fac 0 = 1
fac n = n *fac (n-1)

--Jaybee 21:06, 26 April 2006

Well, it serves the purpose that we get to give an example of a guard. Besides, I wouldn't appreciate claiming something holds for all integers when it only holds for positive integers. And when you're running this as a program, "non-exhaustive patterns" is a nicer note that something went wrong than infinite recursion. --TuukkaH 20:45, 26 April 2006 (UTC)
Makes sense, thanks --Jaybee

Explanations of the examples

Can someone knowledgeable about Haskell please add some commentary to the "More Complex Examples" section, similar to what is there for the "Examples" section? The syntax is a bit abstruse for those not already familiar with the Haskell language. Kwertii 18:46, 20 February 2006 (UTC)

I suppose the point is that those who are intrigued by the examples can turn to the language definition and tutorials for syntax and pure functional programming in general. I don't think we can teach all in this article, but we could try to add notes on what's the point in each example and links for more info elsewhere in Wikipedia. The parallel list comprehension link will help something, algebraic data type has something on lists although they should have an article of their own, corecursion isn't very helpful for the moment. --TuukkaH 20:05, 20 February 2006 (UTC)

I've put in a bit about the linear-time Fibonacci sequence. It seemed that lazy evaluation and infinite lists were the relevant points to make about that bit of code. I don't really know what to say about the others though. The RPN calculator could, I'm sure, be written that way in most functional languages? Ithika 16:48, 11 March 2006 (UTC)

Why nobody learns Haskell

I now have some insight into Haskell, and also some insight into why it is not more popular.

Take a simple example such as fib:

Hugs.Base> fibs = 0 : 1 : [ a+b | a <- fibs | b <- tail fibs ]
ERROR - Syntax error in input (unexpected `=')


Prelude> fibs = 0 : 1 : [ a+b | a <- fibs | b <- tail fibs ]
<interactive>:1:5: parse error on input `='

If I can't get a simple 1-line example to run with copy and paste, I'm not likely to want to continue. After reading more books I discovered that

Prelude> let fibs = 0 : 1 : (zipWith (+) fibs (tail fibs))

did indeed work (the list comprehension version doesn't work without special flags).

Why do we have examples which do not work in the standard environment? --njh 03:51, 3 January 2006 (UTC)

I'm not sure how relevant this discussion is to this forum, but in general, you can't expect to be able to paste code snippets into an interpreter and expect that they will work. The "fibs = whatever" definitions are legal as part of a compiled program. The interactive Hugs and GHCI require different syntax for definitions. The list comprehension version indeed doesn't work without a flag, as the article mentions: "The same function, presented with GHC's parallel list comprehension syntax:". Haskell is certainly not a language for everybody; writing Haskell programs requires attention and thought, certainly more attention than the minimal amount of attention requires to realize that Haskell interpreters require the "let" syntax for definitions and that GHC extensions have to be enabled using -fglasgow-exts. --Catamorphism 03:59, 3 January 2006 (UTC)
I suggest we remove the section which talks about how to get the code snippets to work in various interpreters and compilers. This is meant to be an encyclopaedia, not a tutorial. Hence, the reason for the inclusion of code examples should be to demonstrate what Haskell code looks like. Choosing a programming language at random and thinking, "what kind of language is that?" is best answered by examples on the page. But no-one goes to an encyclopaedia to learn functional programming (or they shouldn't, anyway). By way of comparison, the *ML language-family pages tend to introduce code first, then demonstrate interactive interpreters separately. Opinions? Ithika 18:52, 20 January 2006 (UTC)
I thought the remarks are in place; I would say that in general, you can paste code examples into an interpreter and toy with them. The definition-assignment differentiation and the let clause for monads are something that easily trick anyone wanting to have a look at the language. --TuukkaH 19:43, 20 January 2006 (UTC)
First I have to disagree with njh. The interpreter is not the standard environment. The 'standard environment' is putting the examples in a .hs file and then loading/running it with the interpreter. Secondly, I do not think it is the purpose of Wikipedia to explain this, as strictly speaking is not part of the Haskell language and as Wikipedia is not a how-to guide. If people want to learn Haskell from scratch, writing a Wikibook for them would be a better idea, in my opinion. Cheers, —Ruud 17:09, 28 January 2006 (UTC)
And second?
"If I can't get a simple 1-line example to run with copy and paste, I'm not likely to want to continue." The great thing about computers, the web, hypertext and Wikipedia is that you don't have to leave out important notes because they don't fit in the margin. You can copy and paste, and Haskell even has interpreters so you're able to directly try out on a computer instead of trying to evaluate in your mind. The value of the examples is much less if they're limited to appearances. I understand your fear of How-Tos, that's why I made the note into a box outside the text flow. --TuukkaH 18:10, 28 January 2006 (UTC)
I do not consider the "green thing" outside the text flow, on the contrary. I remain by my point that it is unencyclopedic, and that we shouldn't include it just because we can. Wikibook would be the perfect place for this, but on Wikipedia we shouldn't bother the casual reader with a implementation-specific how-to only there to satisfy the person that is to lazy to read the manual of the Haskell implementation he/she has chosen to test the examples with. (I apologize for stating it so bluntly, not being a native writing means I usually have problems with phrasing such thing more eloquently) —Ruud 18:19, 28 January 2006 (UTC)
For some reason, you want to be exclusive and I want to be inclusive. We gain a lot if readers can try out the examples. If you have read enough on Haskell to know why to transform the examples and how, you're not in the majority of our audience any more. "The Glasgow Haskell Compiler User's Guide, Version 6.2: 3.4.2. Using do-notation at the prompt" won't tell you what you need to know even if you're not lazy. In your latest edit and here, you don't seem to consider that we're talking about different contexts in standard Haskell. There's the declaration top level of .hs files and there's the do notation level. That's confusing. It's a de facto standard that Haskell interpreters allow only expressions and do statements, and limit them to one-liners. --TuukkaH 20:44, 28 January 2006 (UTC)
I'm not being exclusive, I just think such material belongs in a Wikibook, not in an encyclopedic article. Furthermore, the Haskell interpreters were never meant to accept a program from the keyboard, but always through a file, just as is the case with C, Java and Prolog. This is probably the reason why the i in GHCi stands for interactive and not interpreter. Maybe it would be better not to inform people how to transform programs so they can be typed directly in the 'interpreter' be tell them how to do it the right way, which doesn't require that much more effort. —Ruud 21:02, 28 January 2006 (UTC)
While Hugs and GHC are by far the most widely used compilers/interprets for Haskell, I would consider putting instructions on how to use them in this article the same as putting instructions in the C programming language article on how to execute the examples in Microsoft Visual C. —Ruud 18:25, 28 January 2006 (UTC)
And yet that page does indeed have some notes about getting the examples to work on different compilers (note that this is perhaps an unfair comparison as C does not, in general, have an interpreter). For example: The above program will compile correctly on most modern compilers that are not in compliance mode. However, it produces several warning messages when compiled with a compiler that conforms to the ANSI C standard. . Furthermore, looking at Lisp programming language, Lua programming language, OCaml, Python programming language, Perl and Ruby programming language, the examples all work in the Debian provided interpreters either without further note, or with specific instructions on how to use. It's a shame that Haskell, a language which is otherwise quite elegant, gets the interpreter so wrong. Is there a simple explanation as to why the interpreters differ from the compiler? njh 19:51, 28 January 2006 (UTC)
Because you will normally only use the interpreter to test functions you have written in your source file with different parameters. This only requires a single line. Even the most simple program will require several lines which the interpreter won't accept (unless you transform the program into a single line). The normal way is to type your program in an editor, save it to a .hs file, start the interpreter with ghci Example.hs, and type main to start it. Giving the one-line hack as the first example will only mislead reader as it gives the impression that Haskell has an awkward curly-bracket style syntax, which normally does not. In this respect the interpreter might be wrong for new users but is much better suited for "real" users. For example the interpreter allows you to do more than just execute types in code, such as running the type inferencer on a specific function or browsing modules, which as far as I know th Perl interpreter won't let you. —Ruud 20:10, 28 January 2006 (UTC)
So the Haskell interpreters are broken as they can't deal with multiple line input? Has someone submitted a bug report on this? I think the article should warn people that the Haskell interpreters have an awkward hack to get around their lack of multi-line editing. Perl types are not inferred, they are attached to the variable name (in the form of @, $ etc) and set at declaration. I'm sure that if Perl was in the least bit interested in type inference there would be a whole pile of modules and notation to deal with it... A better example might be to compare to OCaml. njh 22:32, 6 February 2006 (UTC)
No, the interpreters are not broken. They require different syntax and this is well-documented in their manuals. Catamorphism 22:56, 6 February 2006 (UTC)
It wouldn't make any sense to allow function definitions using the ordinary syntax in a Haskell interpreter. Remember, Haskell is a static language. It's not possible to change an existing definition without recompiling the module it's in. The syntax in the interpreter is different because it's actually creating a local binding, not a definition. Cadr 22:24, 20 February 2006 (UTC)

One-line syntax for definitions

In the Examples section, there is a one-line definition for the fac function. According to Aaron McDaid, the syntax for this definition doesn't work in Hugs. It does work in Ghci. I only use Ghci and had assumed that the different interpreters used the same syntax for entering a definition in one line. If different interpreters really have different syntaxes for this, perhaps we should just get rid of the one-line example, and remove details that are specific to specific Haskell interpreters, as that would be getting rather non-encyclopedic. --Catamorphism 20:47, 1 March 2006 (UTC)

this is a comment I had put in another thread. It really belongs here as a response to Catamorphism
The second sample of code on the article was
  1. let { fac 0 = 1; fac n | n > 0 = n *fac (n-1) }
  2. let fac 0 = 1; fac n | n > 0 = n *fac (n-1)
  3. fac 0 = 1; fac n | n > 0 = n *fac (n-1)
The article did say (#1), then (#3) (my version), now it's (#2) as of 20:49, 1 March 2006 (UTC).
I can't get either of the first (#1) or (#2) to work in hugs or runhugs, whereas (#3) does work. With (#3) I do
  • fac 5 where fac 0 = 1; fac n | n > 0 = n *fac (n-1)
to use it in hugs.
So basically, is there a portable version that'll work in as many compilers and interpreters as possible? --Aaron McDaid (talk - contribs) 20:49, 1 March 2006 (UTC)
The parallel list comprehension link will help something, algebraic data type has something on lists although they should have an article of their own, co-recursion isn't very helpful for the moment. --TuukkaH 20:05, 20 February 2006 (UTC)
I've put in a bit about the linear-time Fibonacci sequence. It seemed that lazy evaluation and infinite lists were the relevant points to make about that bit of code. I don't really know what to say about the others though. The RPN calculator could, I'm sure, be written that way in most functional languages? --Ithika 16:48, 11 March 2006 (UTC)
Hi guys, I was wrong in March [1] when I said some of the one-line examples didn't work in hugs. I've been able to get them working. Basically this works in hugs let { fac' 0 = 1; fac' (n+1) = (n+1) * fac' n} in fac' 5 (Note the "in fac' 5" on the end). The only real issue with the command line hugs interpreter is that you cannot define a function in one command from the keyboard which you then use in a later command - you have to put both on one line as above. ghci,ghc, and runhugs don't have this restriction. That'll teach me not to edit pages before I know the language well :-). I'll describe a suggested edit here on the talk page later - I want to make sure hugs users can see how to get the examples working. Aaron McDaid (talk - contribs) 15:01, 9 September 2006 (UTC)

Resetting indent. This is what I'm thinking of changing near the start of the the Haskell_programming_language#Examples section:

... first few lines ...
 let { fac 0 = 1; fac n | n > 0 = n * fac (n-1) }
in ghci, then type this to run the function and see the output 120
 fac 5
In hugs, you need to enter the function definition on the same line where you call it to get the same result:
 let { fac 0 = 1; fac n | n > 0 = n * fac (n-1) } in fac 5

I'll wait a while before making this change. Thanks in advance for any feedback. I suppose we don't want to turn this into a full user manual for hugs and ghc(i) Aaron McDaid (talk - contribs) 15:24, 9 September 2006 (UTC)


Is the infobox correct in asserting that there are no dialects of Haskell? Then why the difference between '98 and all the others? —The preceding unsigned comment was added by Marudubshinki (talkcontribs) 21:48, 11 April 2006 (UTC2)

Unclear criticism

This really needs to be clarified:

Haskell has many advanced features not found in other programming languages; these features can and have been criticized for making the language more complex and difficult to understand.

As it stands suggests that the problem is that Haskell has differences from other languages and that the critic simply wants to suppress diversity. This would not be rational criticsm, because it suggests that the ideal is that only one unique language exist. The problem may have been misphrased to avoid the real criticsm, or it may have been included without there being any real merit behind it. --ToobMug 01:37, 24 April 2006 (UTC)

I think the key modifier is "advanced" (monads, anyone?). I agree that the formulation needs to be made more precise. Fredrik Johansson 06:33, 24 April 2006 (UTC)

"A History of Haskell" paper

Simon Peyton Jones, Paul Hudak, John Hughes, and Philip Wadler are currently working on a paper describing the history of Haskell. This paper is currently in draft state, but will be submitted to the History of Programming Languages conference (HOPL'07) once it is finished. The draft is publically available and already is a very valuable source of information. — Tobias Bergemann 09:55, 4 August 2006 (UTC)

Requested move

Haskell programming languageHaskell (programming language) – Conformance with WP naming conventions LotLE×talk

I've just moved it as per the decision below, and fixed up the double redirects. Aaron McDaid (talk - contribs) 11:37, 11 September 2006 (UTC)
The discussion preceeding the move can be found at Wikipedia talk:WikiProject Programming languages/Renaming poll.

delete wxHaskell?

I recently started an article for wxHaskell, one of the many bindings for WxWidgets. It has been nominated for deletion as it "Does not assert notability". Please have a look at it and improve it if possible, especially if you are a fan of wxHaskell. Aaron McDaid (talk - contribs) 13:33, 11 September 2006 (UTC)

confusing sentence

"This sentence does not make much sense: he Glasgow Haskell Compiler compiles to native code on a number of different architectures—as well as to ANSI C—using C-- as an intermediate language." --using c-- ?? 13:12, 4 March 2007 (UTC)

This is an old question but I figured I'd jump on it. This is a fairly standard approach to handle compilation. Write a generic: Language X -> C translator and then use a platform specific C compiler handle C -> platform specific instruction code. See P-code machine for a more broad based discussion jbolden1517Talk 18:58, 31 March 2009 (UTC)

Concurrent Haskell

What's the status of Concurrent Haskell? I've found this reference:

PEYTON JONES, S., GORDON, A., AND FINNE, S. Concurrent Haskell. In 23rd ACM Symposium on Principles of Programming Languages (POPL’96), pp. 295–308.

and it's also recently described in Composable Memory Transaction, 2006.

Bartosz 01:55, 7 March 2007 (UTC)

= is non-kludgy way to implement the type schema Z/mZ (m integer >1)

Say in haskell I wanted to implement the types Z/mZ i.e. "integers mod m" for all integeres m>1. Naturally I'd want to implement the arithmetic operator / for these types. Context: In 1992-3 I faced this prob while writing haskell code for smith reduction for all integral domains where it makes sense. (Which in turn was part of a homological-algebra package). The best I could do was to define a single type Zmod, and replace the binary operator \a \b a/b by a ternary function \a \b \m "a/b mod m" . Which meant that even for the integer type, I had to replace (/) by that ternary function and pass it a dummy argument that it ignored.

Was I missing something then? Is there in newer haskell versions a way to define type schemas? (ie nonconstant type-valued functions of at least one argument). [I suppose not - is Type yet a Type in Haskell?] Or at least to do the stuff mentioned in the above paragraph in a less kludgy way? I guess not - types are untermenschen in haskell, subject to compulsory type checks which had better be "finite" - "infinite" type checking being "inefficient" - so e.g. you cannot write the fixedpoint operator named after Haskell Curry in the language named after Haskell Curry. (nor can you write the noniterative nonrecursive factorial program that works by passing a function as an argument to itself, 'cause that function would have "infinite" type. —The preceding unsigned comment was added by (talk) 03:51, 29 March 2007 (UTC).

This isn't the right place for programming advice, so email for follow up. What it sounds like you want is [2]. jbolden1517Talk 13:19, 29 March 2007 (UTC)


Perhaps a pronounciation ought to be given? I suspect it's probably pronounced as the last name of "Beaver" Cleaver's buddy Eddie, but in my head it always sounds closer to Pascal (programming language). --Belg4mit 18:37, 7 April 2007 (UTC)

I don't know. I'd also be interested in seeing an IPA-pronunciation. Wikitionary or don't give pronunciation on this entry either. I'd hereby like to invite a knowledgable fellow wikipedian to help. --Netizen (talk) 08:04, 24 June 2009 (UTC)

Code examples

Heh, whatever. These code examples are all taken from some sort of freshman Haskell course and are nothing like Haskell code looks like out there in the wild. I note my attempt to add such an example and clean up the current mess has been summarily reverted. —The preceding unsigned comment was added by (talk) 11:43, 11 May 2007 (UTC).

I thought your example was a good one. I said as much. I think it would be useful for wikibooks. But it involved several complex ideas and it was highly monadic. Moreover you deleted other examples. jbolden1517Talk 11:47, 11 May 2007 (UTC)
Ooooo Monads, those are so scary, don't you think so? I thought about mentioning uns*fePe**orm*O, but thankfully I regained my senses and removed it. God forbid we show Haskell is good for anything but producing Fibonacci numbers, a computing concept so important it obviously has to be demonstrated in several slightly different but equivalent ways. Similarly we should keep the verbose idiocy about how to get the examples running in Hugs and ghci because obviously various people come here and we should really aim for the lowest common denominator persons. —The preceding unsigned comment was added by (talk) 12:41, 11 May 2007 (UTC).

If you would like to discuss this:

  1. Get an account
  2. Sign your posts with 4~ 's
  3. Lose the tone of superiority.

jbolden1517Talk 13:23, 11 May 2007 (UTC)

Who made you king of Wikipedia that you may make demands in such a manner? —The preceding unsigned comment was added by (talk) 17:27, 11 May 2007 (UTC).
I'm not sure if he's actually the King of Wikipedia, but his demands (at least the last two) reflect established Wikipedia policies. See WP:TALK, and for both points, and specifically WP:CIVIL for #3. As for the first demand, it's a bit easier for you to carry on discussion if you have an account, but you're certainly welcome to remain anonymous. Staecker 17:43, 11 May 2007 (UTC)

'Influenced: Python'

I don't really see what aspects of Python are owed in particular to Haskell. Perhaps lazy streams, but is there any evidence that it did so directly? Jogloran 13:14, 13 May 2007 (UTC)

From the Python page: Python 2.0 borrowed a major feature from the functional programming language Haskell: list comprehensions. 05:44, 24 May 2007 (UTC)

Multiple dispatch?

Would you folks say that Haskell supports multiple dispatch? If so, could you update that article? I'm not too sure. It was this section of that article that piqued my curiousity:

(from multiple dispatch) "In languages with multiple dispatch, all the arguments are treated symmetrically in the selection of which method to call. Matching recognizes first, second, third, etc. position within the call syntax, but no one argument "owns" the function/method carried out in a particular call."

One of the things I like about Haskell is that it supports (something like) the above. In Haskell, the first argument isn't special, and typeclasses can be used on any argument:

meth :: (A a, B b) => x -> a -> b

Aaron McDaid (talk - contribs) 17:20, 16 December 2007 (UTC)

Single and multiple dispatch are both forms of dynamic dispatch. They come out of the object oriented world where the function (method) to be dispatched to is unknowable until runtime (hence the "dynamic"). In Haskell type classes the choice of function is made statically. As such, the terminology used by Haskellers to describe that kind of behavior is "overloading" and shares more similarities with the statically bound overloading available in languages like C++ and Java than the multiple dispatch of Common Lisp and Dylan or the dynamic single dispatch overriding of C++/Java. One major (and crucial) difference between Haskell type class overloading and C++/Java overloading is that in Haskell the choice of which overloaded function is called may depend on nothing more than the static type of the result. In C++/Java the choice of overloaded method depends on the static types of the parameters only. See the article on monads in functional programming - different unit functions must be chosen based entirely on the expected return type. —Preceding unsigned comment added by (talk) 14:14, 8 February 2008 (UTC)

Influence on Java

I'm not sure that Java generics rise to the level of an influence from Haskell. True, there is the Philip Wadler connection, but IMHO Java's generics are just a form of parametric polymorphism (which pre-dates Haskell, e.g., in ML and Miranda) with the syntactic flavor of C++ templates. Clconway (talk) 23:22, 4 January 2008 (UTC)

Working examples, please

I downloaded GHCi from, tried the examples on the Wikipedia page, and found most of them didn't work. This is hugely confusing. One of the examples with "let" that's recommended for Hugs worked for me, which is also confusing since I'm not running Hugs, and the page says GHCi doesn't have that restriction.

I see from the comments above that this problem has come up before. I respectfully suggest that the examples should work with the standard Haskell system. Billgordon1099 (talk) 05:46, 7 June 2008 (UTC)

It can be very confusing for a beginner. When defining a function an GHCi, one must write, for example, "let foo x = x * x", all in one line. You could then use "foo" wherever you like. For testing, I recommend writing all functions in a file, loading that file with GHCi using ":l file.hs", then testing the functions from there. --Kinghajj (talk) 15:06, 15 September 2008 (UTC)

the long-term forthcoming

an implementation for the long-term forthcoming Perl 6 language

What does this mean? Regards, Ben Aveling 08:59, 7 September 2008 (UTC)

It means it's been under development for a long time.—greenrd (talk) 14:33, 7 September 2008 (UTC)
Yes, I see. The English could be tweaked a bit. What about:
Haskell has been used in a number of high profile projects, including: Audrey Tang's Pugs, a long awaited implementation of Perl 6; GHC, a testbed for advanced functional programming features and optimizations; the revision control system Darcs; Linspire GNU/Linux's system tools[1]; Xmonad, a window manager for the X Window System; and Bluespec SystemVerilog, a language for semiconductor design that is an extension of Haskell, and is implemented in Haskell.
Regards, Ben Aveling 12:04, 8 September 2008 (UTC)

SPJ replies to our (old) criticism section

Interesting reading; see the original question and answer and related followup. Do we merge these into the article? --Gwern (contribs) 23:18 19 September 2008 (GMT)

Lead section

I am a bit nervous about the following recent addition to the lead section: "An open source product of more than twenty years of cutting edge research, it allows rapid development of robust, concise, correct software. With strong support for integration with other languages, built-in concurrency and parallelism, debuggers, profilers, rich libraries and an active community, Haskell allows for the production of flexible, maintainable high-quality software." This text was apparantly copied and pasted from While I basically agree with the text, I feel that as written it does sound too much like marketing speech, and I was tempted to revert the edit. Maybe the text could be rephrased or at least supplemented with appropriate references? — Tobias Bergemann (talk) 08:10, 21 October 2008 (UTC)

It is taken directly from the official site, and so it a copyright violation, which means it should be deleted with extreme prejudice. Staecker (talk) 11:42, 21 October 2008 (UTC)
The official site is a wiki with a simple permissive license which does not even require attribution:
"Permission is hereby granted, free of charge, to any person obtaining this work (the "Work"), to deal in the Work without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Work, and to permit persons to whom the Work is furnished to do so."
I am more concerned about the phrasing than the licensing. However, as you have already reverted the edit (thanks), this has become irrelevant. — Tobias Bergemann (talk) 15:07, 21 October 2008 (UTC)
You're right- thanks. I agree it is inappropriate language in any case. Staecker (talk) 17:19, 21 October 2008 (UTC)

Point-free programming application

The latest addition to the article suggests that mapReduce could be simplified from 1) to 2)

1) mr takes a list, applies a function to it and then reduces the elements based on a criterion

mr criteria operator list = reduce criteria (map operator list)

which can be expressed point-free as 2)

mr = (. map) . (.) . reduce

--Ancheta Wis (talk) 18:15, 31 March 2009 (UTC)

That was me. Was that a point of interest or did you have a question/comment/concern or...? jbolden1517Talk 18:53, 31 March 2009 (UTC)
Not a concern, rather a talking point for the inherent efficiency of higher order functions to show how it is more expressive than our current popular programming languages. Perhaps such an example could be a poster child for the language. --Ancheta Wis (talk) 22:21, 31 March 2009 (UTC)
I neglected to say: Well Done, JBolden! Thank you for your contribution to the encyclopedia. --Ancheta Wis (talk)

Well thank you! Nice to hear you like. Yeah I got a kick out of that one when I worked it out the first time. The one that made a convert out of me was the Eight queens puzzle solutions:

queens :: Int -> Int
queens n = map reverse $ queens' n
   where queens' 0       = [[]]
         queens' k       = [q:qs | qs <- queens' (k-1), q <- [1..n], isSafe q qs]
         isSafe   try qs = not (try `elem` qs || sameDiag try qs)
         sameDiag try qs = any (\(colDist,q) -> abs (try - q) == colDist) $ zip [1..] qs

I saw that solution and it got me to learn Haskell. Look at those C#/Java/Python solutions comparatively, talk about a mound of boilerplate. Wikipedia has haskell/FP versions all over the place, I personally think this trend is likely to start selling people on FP, at least I hope jbolden1517Talk 02:28, 1 April 2009 (UTC)

Removed goal

I've removed the goal from the article because it's of little use to people who don't know Haskell (or to those that do) and it's POV too. What if I opened the article about Java and discovered (written with 'we' to show my point):

Java is an advanced programming language and we've got an active community, lots of rich libraries, excellent integration with other languages and if you use Java, you'll experience rapid development and your software will be robust, concise and correct. Oh, and did we mention the joys of cutting-edge research for twenty years?

It may all be factually correct for Haskell and it should all be in the article but not by repeating the project's goals: after reading the article, the reader should be able to conclude whether this holds or not. Simeon (talk) 15:54, 5 April 2009 (UTC)

Java actually has such a section Java (programming language)#Primary goals. jbolden1517Talk 16:44, 5 April 2009 (UTC)
Ok, but in a philosophy section it's more acceptable than using it as main introduction in an article. I must say I didn't check the Java article, I also could have used language X as I just meant an arbitrary language. - Simeon (talk) 16:53, 5 April 2009 (UTC)

Perhaps the goals could be re-instated with a balancing sentence, such as "For twenty years, the strategy was to 'avoid success at all costs' until the language proved it had begun to meet the goals". The language has been supported in the academic setting, using a manageable number of programmers, which allowed the development of libraries, proven integration with other languages using the Foreign Function Interface and gcc. Theoretical proofs of the correctness of programs was aided by Haskell's close similarity to mathematical notation. The dangers of side-effecting I/O for lazy languages were isolated to monadic I/O. ... --Ancheta Wis (talk) 22:24, 5 April 2009 (UTC)

Being more serious I think this should go in a lower section. Also I think we should use the 5 design goals from the haskell 98 report (since those are "official):

  1. It should be suitable for teaching, research, and applications, including building large systems.
  2. It should be completely described via the publication of a formal syntax and semantics.
  3. It should be freely available. Anyone should be permitted to implement the language and distribute it to whomever they please.
  4. It should be based on ideas that enjoy a wide consensus.
  5. It should reduce unnecessary diversity in functional programming languages.

[3] Beyond that I think the rest of what was in the goals section are characteristics. For example lazy and pure. jbolden1517Talk 01:06, 6 April 2009 (UTC)

for loop

I'm having a tough time seeing how the new for loop example teaches anything. This looks like a slow complex implementation of map to me. Does anyone disagree? jbolden1517Talk 20:31, 26 April 2009 (UTC)

Syntax highlighting

The syntax highlighting in the code examples looks horrible. It's distracting, makes the examples hard to read, and draws too much attention to some irrelevant details. Furthermore, one-line examples without indentation look too much like short paragraphs of normal text. The general idea of having syntax highlighting might be ok, but the current implementation is so bad that I strongly suggest that we revert back to the version that uses simply "code"-blocks. — Miym (talk) 11:46, 26 June 2009 (UTC)

Borders and gray background have now been reinstated, restoring much of the lost readability in my eyes. However, I myself would prefer not to use syntax highlighting at all for code examples in wikipedia articles as I find it distracting outside of a code editor. — Tobias Bergemann (talk) 08:58, 1 July 2009 (UTC)

No clear structure

It is not clear to me that this article has an overall structure or theme. Here's a draft attempt to plan a rewrite of the Haskell article, to give a comprehensive account of the language Dons00 (talk) 23:05, 2 August 2009 (UTC)

Please comment.

Moved this section to foot of the page. It is customary to keep talk in temporal order. --Ancheta Wis (talk) 23:13, 2 August 2009 (UTC)
I've made a start on this over at User:Simonmar/Haskell_(programming_language). So far I've only added an overview section. Hack away, and let's clean up this article. Simonmar (talk) 22:58, 2 December 2009 (UTC)


  1. ^ "Linspire/Freespire Core OS Team and Haskell". Debian Haskell mailing list. 2006.  Unknown parameter |month= ignored (help)