News for hackers. Stuff that matters.
Re:Why Haskell is beyond ready for Prime Time by wernerv0nbraun on Wednesday January 14, 2009 @11:49PM (#434827)
this haskell example is exposing you to two cool things:

- algebraic types. haskell has type inference, so it can do the right thing while you only describe the function as operating on lists. now look at java...strong typing but no intelligent inference, which is why you are forced to write retarded java like HashSet<Integer> s = new HashSet<Integer>()

- pattern matching. you can describe functionality based on the pattern of the data

this isn't just syntax. these are really powerful fundamental features of the language

Re:Why Haskell is beyond ready for Prime Time by lacker on Thursday January 15, 2009 @03:17PM (#435651)
Yes, I totally agree. But the question I was responding to was just, "What parts of Haskell have weird syntax?" All of this cool stuff would also be possible with c-like syntax.
Re:Why Haskell is beyond ready for Prime Time by brl on Thursday January 15, 2009 @01:14AM (#434913)
Retarded? Really?

I guess that you don't know that generics in Java were derived from Haskell type classes and designed by the same man who added monads to Haskell.

Re:Why Haskell is beyond ready for Prime Time by fhars on Thursday January 15, 2009 @07:26AM (#435088)
Retarded, indeed. Almost half of that code is a redundant repetition of type information.
Re:Why Haskell is beyond ready for Prime Time by brl on Thursday January 15, 2009 @11:47AM (#435309)
It's not redundant information and in Haskell you write exactly the same thing.

  doSomething :: HashSet Int -> HashSet Int
Re:Why Haskell is beyond ready for Prime Time by jganetsk on Thursday January 15, 2009 @07:17PM (#435964)
And that man would absolutely love it if Java had a type system closer to Hindley-Milner with type inference. But, given the reality of Java, generics become undesirably verbose.
Re:Why Haskell is beyond ready for Prime Time by brl on Thursday January 15, 2009 @08:01PM (#436009)
A typical well written Haskell program has more type annotation than the same program written in Java. Not only that but because of type classes those annotations are even more verbose than an equivalent declaration in Java.

It's true that you can omit most of the type signatures and let the compiler figure it out but nobody really writes Haskell code that way if they want it to be comprehensible by human readers.

Re:Why Haskell is beyond ready for Prime Time by silentbicycle on Friday January 16, 2009 @12:01AM (#436178)
I've wondered about this. It seems common for OCaml code to only have the type annotations where necessary, but it's usually included in Haskell by convention.
Re:Why Haskell is beyond ready for Prime Time by eru on Thursday January 15, 2009 @11:34AM (#435292)
He had to work in the constraints of the language..