Live data from Hacker News

The New Haskell Homepage

new-www.haskell.org

111–120 of 258 posts

Re: The New Haskell Homepage

#111

I get paid to write C++ code. I'm pretty good at it. I understand it's normal usage syntax very well. I don't fucking know what a god damn thing means in Haskell. λ 5 + 7 12 :: Num a => a What the christ? The 12 I get. Got it. The colons? Not sure. I think it's just a dumb separator. Num is type! What the hell is a => a? I have no idea. In the top they have an example. primes = sieve[2..] where sieve (p:xs) = p : sie…

> I understand it's normal usage syntax very well.

You understand C++ syntax because you're familiar with it, not because it is "normal" in any way.

Re: The New Haskell Homepage

#112

I get paid to write C++ code. I'm pretty good at it. I understand it's normal usage syntax very well. I don't fucking know what a god damn thing means in Haskell. λ 5 + 7 12 :: Num a => a What the christ? The 12 I get. Got it. The colons? Not sure. I think it's just a dumb separator. Num is type! What the hell is a => a? I have no idea. In the top they have an example. primes = sieve[2..] where sieve (p:xs) = p : sie…

Yours isn't an uncommon reaction, don't sweat it.

I remember being thoroughly confused by what I was reading back when I started learning Clojure, after years in C# and ruby. At first I thought no normal human being could understand just what the heck was happening amongst all of those parentheses, but eventually it became second nature. Now I've probably written a good 50KLOC in the language and to me it feels semantically dense, but nonetheless very readable.

I then remember switching to Haskell and thinking the same thing: "What the heck is this alien-speak mumbo-jumbo, how can anybody understand this gibberish?! Phooey!". Except this time I could actually remember myself saying the same exact thing 2 years earlier about Clojure and knew that if I just persevered, it'd eventually feel perfectly natural. It's been a few months, and it feels more natural now, even though admittedly Haskell has a lot more language constructs than the very basic lisp, so it takes a bit longer to build up that visual pattern recognition.

Re: The New Haskell Homepage

#113
I really, really want to get into Haskell and functional programming in general, but I have no idea what sort of project to build with it. Anyone have any good suggestion?

Re: The New Haskell Homepage

#114

I get paid to write C++ code. I'm pretty good at it. I understand it's normal usage syntax very well. I don't fucking know what a god damn thing means in Haskell. λ 5 + 7 12 :: Num a => a What the christ? The 12 I get. Got it. The colons? Not sure. I think it's just a dumb separator. Num is type! What the hell is a => a? I have no idea. In the top they have an example. primes = sieve[2..] where sieve (p:xs) = p : sie…

Ok I'll take a stab at a super high level crash course: A note! Haskell has weird syntax. But it actually uses this syntax in cool ways, as opposed to some languages that have weird syntax in an effort to be different. Let's consider the basic unit of Haskell programming -- the function! Here is a function which returns its input: f x = x Notice that there are no parens or types or anything. Since functions are used…

The way I'd be interested in seeing a high level introduction would be by having some snippets of code in C, and then their equivalents of Haskell. Then an explanation, if that's needed. Because otherwise I'm spending most the time trying to understand what the code examples you wrote actually do in English.

Re: The New Haskell Homepage

#115

I get paid to write C++ code. I'm pretty good at it. I understand it's normal usage syntax very well. I don't fucking know what a god damn thing means in Haskell. λ 5 + 7 12 :: Num a => a What the christ? The 12 I get. Got it. The colons? Not sure. I think it's just a dumb separator. Num is type! What the hell is a => a? I have no idea. In the top they have an example. primes = sieve[2..] where sieve (p:xs) = p : sie…

Ok I'll take a stab at a super high level crash course: A note! Haskell has weird syntax. But it actually uses this syntax in cool ways, as opposed to some languages that have weird syntax in an effort to be different. Let's consider the basic unit of Haskell programming -- the function! Here is a function which returns its input: f x = x Notice that there are no parens or types or anything. Since functions are used…

Wow, you should turn this into a tutorial on FPComplete or something. Maybe there could be an "explain" link under the Haskell example on the homepage and it link to a tutorial like this one.

Re: The New Haskell Homepage

#116
post #59

Earlier quoted context omitted.

Could you suggest a simpler example? Finding primes is something that is taught in the first programming class in Indian high schools. I guess I've never thought of it as something hard. I looked at nodejs.org, and their first example is a web server! Python has the Fibonacci as it's second example (the first one show's numeric operations). Ruby does simple string operations on it's home page. While I think that is i…

Fibonacci sounds perfect! fibonacci :: Integer -> Integer fibonacci 0 = 0 fibonacci 1 = 1 fibonacci n = fibonacci (n - 1) + fibonacci (n - 2) Arguments for this: * "Find the Nth Fibonacci Number" is among the most universally known programming tasks, so visitors are far more likely to immediately pick up the example than they are with sieve. * It shows off a bit of Haskell syntax that (A) can be learned just by looki…

I think the factorial function is even nicer: everyone with basic high school math has seen it. It's even shorter.

Also, I think the example should not be a partial function ;).

Re: The New Haskell Homepage

#117

Earlier quoted context omitted.

Ok I'll take a stab at a super high level crash course: A note! Haskell has weird syntax. But it actually uses this syntax in cool ways, as opposed to some languages that have weird syntax in an effort to be different. Let's consider the basic unit of Haskell programming -- the function! Here is a function which returns its input: f x = x Notice that there are no parens or types or anything. Since functions are used…

Wow, you should turn this into a tutorial on FPComplete or something. Maybe there could be an "explain" link under the Haskell example on the homepage and it link to a tutorial like this one.

I'm actually recoding my website right now with a webserver and framework I custom built in Haskell. Maybe I'll make some of my first posts on this topic in a more formal, less commenty manner.

Re: The New Haskell Homepage

#118
post #25

Another suggestion would be more examples under the clear concise code bit--possibly in a carousel. Additionally, all examples could be loaded into the "Try It" section, so I could type `take 4 primes` or something. Instead, in my attempt to load the primes function.. I was met with this bit. λ let sieve (p:xs) = p : sieve [x | x

I agree, but I'd go even further: make the example in the corner actually tryable the "Try It" section. For this example: primes = sieve [2..] where sieve (p:xs) = p : sieve [x | x I tried to type it into the shell: λ primes = sieve [2..] :1:8: parse error on input `=' It doesn't work. Okay, what if I copy and paste? λ primes = sieve [2..] where sieve (p:xs) = p : sieve [x | x :1:8: parse error on input `=' Doesn't w…

Haskell is still avoiding (success at all costs), the bracketing is very important. Haskell may seem like a slow to develop language and community at times, but this is because most users want to see well thought out solutions to problems, and if they have theoretical backgrounds showing that what they're doing is a good idea, even better.

Re: The New Haskell Homepage

#119
post #89
post #36

I feel like the sieve is a poor example, since it's not actually the same algorithm as a sieve, and has a worse running time. It is possible to write a very nice lazy infinite sieve. See O’Neill's "The Genuine Sieve of Eratosthenes" paper for details. http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf

It fits the tradition established by the quicksort that isn't really a quicksort.

That example does match some high level definitions of quicksort; "pick a pivot element (the first element of the list), split the rest of the list into elements less than and greater than or equal to the pivot, quicksort those recursively, then reassemble the lesser, pivot and then greater elements". But I do agree it's not quicksort as it's usually known with its in place sorting and O(1) extra storage.
Post reply on HN