Hacker News new | past | comments | ask | show | jobs | submit login
The New Haskell.org (haskell.org)
312 points by dons on Feb 15, 2015 | hide | past | favorite | 103 comments

I'm new to Haskell, and I like this page. So, wanting to get a feel for it, I tried typing the sieve example from the top of the page into the "Type Haskell expressions in here." box right beneath it.

First, I got

    <hint>:1:8: parse error on input `='
Hm so apparently definitions aren't expressions? Or something?

I decided to remove the `primes = ` part, which made my browser really slow and had no result. I'm assuming it was computing all primes in the background.

Now, of course, maybe I should try to understand the sieve example before running it, but isn't the whole point of having a REPL box on the front page that you can facilitate people who learn the other way around? It would be great if there'd be some code or expressions available at my fingertips that would actually work in that REPL.

In other words, maybe make the first example be something that actually terminates?

Please read this as constructive criticism, which is how it is intended.

EDIT: Only now I'm noticing that exactly the things I ask for are listed to the right of the "try" box. Pardon my lazy reading, I'm really enjoying the tutorial right now. Still, making the `sieve` example terminate would be nice. But I believe my nitpick is maybe a bit much of a nitpick now.

Two problems:

1. multi-line expressions aren't supported by the REPL.

2. You will need to use `let x = ..` syntax in the REPL (This is because the REPL are just so called IO-actions and the `let` syntax defines variables within its lexical scope)

You could try this:

    > let sieve (p:xs) =  p : sieve [x | x <- xs, x `mod` p /= 0]
    > let primes = sieve [2..]
    > primes !! 3
    > primes !! 4
Nice part abou this code is eventhough you express calculating ALL primes. It will only calculate upto the 3rd and the 4th prime due to lazy evaluation. This is one of the great strengths of haskell.

This online REPL does not support `let` either.

`let x = 4` is not an expression there.

At the online REPL, you have to write something like:

    let primes = sieve [2..] where sieve (p:xs) = p : sieve [x| x <- xs, x `mod` p /= 0] in primes
Which is rather annoying.

Not only that, but you have to do something like

    let primes = ... in take 5 primes
... if you want the computation to complete without hanging the browser. It would be nice if the REPL supported multi-line expressions.

The biggest problem isn't what others have said. The biggest problem is that the try box doesn't let you define your own functions or variables.

Therefore, even if you were an old hand at GHC and GHCi and so on, you'd still be unable to run the code it shows at the top of the page.

This is probably bad website design. Especially since the website still lets randoms burn themselves by entering non-terminating code that makes their browsers slow.

The code doesn't run in-browser. It runs in a sandboxed environment elsewhere.

I agree with the problems but am curious how you would solve the non-terminating code problem?

> I agree with the problems but am curious how you would solve the non-terminating code problem?

I thought it was running on the browser, based on what the OP said, so that would entail opcode-counting or, if you can use multiple threads, watchdog timers. That is, don't try to solve the halting problem, just enforce an arbitrary limit to how long code can run.

However, if the code is being run on the server, you could enforce CPU and RAM quotas to do the same thing with the OS's help.

Yeah, the online REPL is definitely not very useful or intuitive yet.

As it says, you can evaluate a single line Haskell "expression" and top-level declarations (like the sieve example) are not expressions. In addition, the sieve example declares an infinite list so there's no sensible way to print it.

You can fix all the above by using a let-expression on single line and only evaluating a finite part of the list using the 'take' function.

    let { primes = sieve [2..]; sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0] } in take 10 primes

In a normal ghci repl, you would be able to use the syntax "let name = expr", but this repl doesn't seem to support that.

My best guess is that it's because it's implemented as an HTTP service that happens not to retain the ghci process between expressions.

You need to check syntax, or try some more basic examples first. In this case you pasted piece of code that won't work itself.

If you want to get know more about it: http://learnyouahaskell.com/syntax-in-functions

Sure, but my point is that maybe the top example should be one that'd work verbatim in the REPL, to not scare noobs like me away.

Yeah, the REPL story's a bit of a mess, but Haskellers tend to forget that.

Just to mention it here, IHaskell solves a lot of the annoyances with ghci. Easy multi-line input, don't need let in front of functions, can define modules and load them (automatically compiled), etc. I think they are working on support for template haskell too (important for experimenting with lens code etc)

Oops, I missed that. Indeed example is not REPL ready.

I totally agree with you.

I really like the new design. The old site was certainly showing its age--very dense and hard to navigate. Never mind the lovely 1990s motif. This is far more welcoming and user-friendly, especially to those who might be curious about Haskell.

It's exciting to witness Haskell gain traction within industry. Facebook announced last week that its building an entirely new Haskell team to focus on distributed systems, data mining, and machine learning. They're also hiring for a second team to support Haxl [1].

For those eager to use Haskell in the workplace, I imagine the new design should make it easier to formulate a compelling business case. Being able to point your project manager and/or colleagues to a website that clearly explains what Haskell is--and what sets it apart--is a big plus.

The source code for the site can be found on GitHub [2]. Awesome work by Chris Done, who kicked this off last year; see his blog post about the motivation for the new site [3].

[1] http://www.reddit.com/r/haskell/comments/2useoq/haskell_oppo...

[2] https://github.com/haskell-infra/hl

[3] http://chrisdone.com/posts/haskell-lang

This new, awesome site is using the framework Yesod[0], which is kinda like the Rails of the Haskell world, only it can do rad stuff like prevent XSS and 404s at compile time. Yes, you read that right.

[0] http://www.yesodweb.com/

You know what is REALLY cool? Almost all haskell web frameworks use the Web Application Interface[0]. Which is a unified interface for haskell web applications. This means you can mount web applications written in OTHER frameworks under your routes and vica versa.

[0] http://www.stackage.org/package/wai

Yeah, wsgi was also cool when it appeared for Python, back in 2003.

Is WAI that popular? I thought Yesod/Scotty used it, but Snap/Happstack did not.

Btw, there's also a sinatra inspired framework – scotty (https://github.com/scotty-web/scotty)

"Bare" snap (snap-core and snap-server) are Sinatra-like too.

It sounds like the feature you're highlighting here is static checking at compile-time of how routes are going to resolve at run-time. Is that right?

Afaict Perl 6 covers this case:


Or am I missing something?

Yesod is a real gem, been using it for most of our web applications and I discover new great things about it every day.

How does it prevent XSS?

2. XSS injection. Any html coming back from a form will be efficiently sanitized just once on arrival. Unsanitized strings will be sanitized before being displayed.


I suspect this is accomplished through safe vs. unsafe types. Imagine the only function from `unsafe___` to `safe___` is the escape function, and all functions giving text back in responses is require to be of type `safe___`.

Tell me more about preventing 404 at compile time. I call http://www.yesodweb.com/bullshit

Presumably the idea is that you can prevent your site having broken internal links by constructing links with data types and checking the links when creating them at compile time. You could actually do something similar in most languages, even dynamic ones, so I don't see what is specific to haskell about it, e.g. rails has link_to and friends which require you to have a route set up in order to link to it (though not compile time). Golang has similar protection for XSS and reverse routes on routers if you require it so again not specific to Haskell.

Clearly you won't be able to prevent (nor would you want to) links like yours above from being a 404, so perhaps no more internal 404s would be more accurate.

Let's be fair here, while you can detect invalid internal links in dynamic languages at runtime, the end result is basically the same for the user - a 404 or a 503 are equally bad in this case.

That's the advantage of compiled languages over dynamic ones in these kinds of scenarios: you sacrifice immediate feedback during development to gain a guarantee from the compiler that all invariants you embedded in the application uphold. And the more powerful the language/compiler combination, the more compile-time guarantees you can specify.

Users of dynamic languages tend to use tests to check for errors that stronger types might catch (like broken links), but I agree having a formal guarantee is a slight advantage, though not specific to Haskell. Golang for example could easily provide similar checking.

The linked website is beautifully done, and the language does look interesting, I just find the hyperbole about static types making websites magically secure a little over-egged - it's still easy to mess up security or create subtle bugs even if you have strong guarantees about some parts of your code at compile time provided by types.

Well, for me broken internal links and a claim that some framework magically avoids 404 errors are worlds apart.


If you're used to only programming in dynamic languages, it can be a shock, but yes, a good type system can do things you never thought possible.

If you were the downvoter, I'll take my vote back now.

I don't know who the downvoter is but I think it's a silly claim to be proud of. Anything more complex than a simple template system can enforce referential integrity of internal links by making the programmer refer to other pages on the site with some kind of handle. It's not rocket science and doing it with the (elaborate) type system isn't necessarily a selling point, in my opinion.

Interestingly, my love for Haskell was re-kindled today and I went to the site to download the latest platform. There is so much wrong with the new site -

1. Earlier, there was a lot of information on the Home Page. Now there's almost nothing. Yes the earlier page was a bit too busy, but crucially comprised simple HTML links and was fast to load. 2. Now there's a big banner saying "Open Source Community Effort for 20 Years" with Vimeo links, which itself is a bad idea. What happened to simple HTML anymore? Anyway, I don't care about the effort - show me the results e.g. Hackage, Hoogle, IDEs, etc. all of which was readily available in the old page but not anymore. 3. Earlier, it was easy to locate the Haskell platform for Windows. Now it takes to a cryptic download page and I am not sure what I am downloading. What is MinGHC?

These are just my initial impressions. Anyway, I wonder why people don't realize that not everything needs to be converted to the "modern web". Sometimes the old web is vastly superior to any modern alternatives.

A new website will never be perfect. Luckily They're very open to suggestions and criticism . There seems to be an active issue tracker here [0] that is used to keep track of feedback. Pull requests seem to be welcomed as well. Quite the friendly community it seems.

By the way. the old website moved to https://wiki.haskell.org/Haskell

[0] https://github.com/haskell-infra/hl/issues

There are couple of ways to introduce anything 'new' -

You can a sit in a small cubic room and whisper about yours ideas all day long, hoping that someday somebody will notice your thoughts and work on it further.

Or you can put up somewhere and present it in a way that causes least drag, so anyone with a slight interest can pick on it.

Or you can use a combination of both.

Today in our fast society, I think it's the balance that matters the most. If you have something interesting to talk about and you are not working hard to let others know about it, then you are doing everybody a disservice.

Something like http://okmij.org/ftp/ ?

I don't understand why they want to use this code

primes = sieve [2..] where sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0]

As their first example of Haskell. It's a prime generator based on trial division. And not even trial division up to sqrt of the number you test, but all the way up.

I like the idea of a small snippet showing of the power of haskell, but there are many much better examples imho. Perhaps the website could just choose one at random at each load?

If the point is to show the power and elegance of the language, why would they complicate the expression with optimizations? The sqrt example is obvious to anyone who understands that line anyway.

What is the point of demonstrating the power an elegance with an example that will (hopefully!) never appear in any real world code? Better to show how the language is still powerful and elegant when taking into account the edge cases and common optimizations.

Writing elegant non-real-world code is much easier (in any language!) than writing real code.

It's the Sieve of Eratosthenes, which is a fairly classic algorithm.

No it's not. It is only superficially[1].

The sieve of Eratosthenes goes like this:

1) Mark 2 as prime. Let it be n.

2) Mark all numbers of the form i times n as composite, where i is a positive integer. (We can do this by stepping over multiples of n. No multiplication needs to take place.

3) The next unmarked number is prime. Let it be n. Goto 2

Notice how this alogorithm does not use division. Division in modern CPUs is slow.

The algorithm presented uses the `mod` operator, which does division. This algorithm is equivalent to the Trial Division Algorithm. Instead of "deleting" multiples of n as composite, this algorithm tests all numbers greater than n for divisibilty by n, and then only does it "delete" the number.

For a more detailed explanation, see http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf

[1] https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Trial_di...

The new web site looks better than the old one but it also makes everything harder: finding documentation, downloading the compiler, explaining the environment and tool chain, etc... All these very important tasks are now hidden behind links to links to links.

I wouldn't be surprised that the average time that users spend on haskell.org goes down as a result (assuming the Haskell team even cares about measuring these things).

I'm glad the page is getting a design refresh, as it needed it, however it may have swung too far in the direction of the latest web scripting language du jour. The 'try it now' box is appealing to the short attention span scripter and not to the engineer. Already you are having to mention IO actions which is a subject that can't be properly explained through a web form.

As for the image, I don't know why it would be interesting to see a picture of a bunch of people at a conference, especially if you go back to the page frequently. Why not some original Haskell art like the Diagrams factoring image?

Regarding the 20 years in development, I agree this fact should be front and center, this is a serious tool that has had a lot of work by very high level thinkers, it is a world away from the origins of Java as far as engineering integrity.

It looks good, but they have to get rid of the out of focus photo. Photos that are entirely out of focus are really annoying and give a lot of people headaches.

Usually out of focus areas should be used to bring the eye to an object in the photo that is in focus. But if such an object does not exist, then the eye wanders and tries to adjust itself to focus (the eye has its own focusing mechanism). But of course it cannot do so, so what you get as a result is strain on the eye and a headache.

Out of focus photos have no business in what hopes to be a mainstream website.

I agree... I didn't even realize there was a videos section between the "Try it" and the "Features" section until I read your comment.

Wow, I’d never heard of this, but apparently it’s a thing. I just see the photo as blurred and that’s that; my eyes don’t try to adjust, maybe because the blurring just seems flat on my monitor. Do you happen to suffer from migraines or vision problems?

That's because I'm waiting for the photographer to get me the full size version. This one I cribbed a low-res version of the net, but it's easily one of the best Haskell conference photos in its original form.

λ do line <- getLine; putStrLn line

> л

mueval-core: Imports.hs: removeLink: does not exist (No such file or directory) ExitFailure 1

What did I do wrong?

You did nothing wrong, the hundreds of active users due to announcement buzz is a little outside the scope of the sandbox's capabilities, it has some race condition under heavy load. We considered spending time optimizing this in anticipating of the announcement, but more pressing issues took priority. Re-running the line should work.

Seems like a bug to me.

You need to use curly braces in single-line do-expressions:

    do { line <- getLine; putStrLn line }

First of all, I took that example from the webpage. And it works in ghci (if printing ? back to me "works", then I guess it works)

Ah, right, sorry. I completely misread your post.

I guess there's something funky in the unicode handling on the site.

If I go to downloads for Windows, I get the opportunity to download an installer for something called MinGHC with no indication of what version it is, and no indication if it is a 32 or 64 bit GHC. Whichever it is, if I want the other one, I'm apparently out of luck.

The Haskell Platform is nowhere to be seen, why?

It looks nice on the surface, but the actual content needs work. And the link to more content is well-hidden at the absolute bottom of the page.

great! I love the fact that "try it" takes center stage. Though there was a lot more information on the old site, I feel the new one does good job of breaking it up into more meaningfully grouped segments.

The sponsors section is confusing to me though, are these actual sponsors or just services that haskell.org uses? Its not actually clear to me based on the text and the relative prominence each is given.

This is a step backwards imho. The fit and finish of this site betrays much about the language and its amazing community.

This feels amateurish, with enough people complaining about the interactive repl and lacking information, this should have gone through more iterations and feedback loops with people outside the Haskell community.

Luckily for everyone, the current discussion here is just such an iteration!

Out of curiosity:

Who has written Haskell & deployed to production in the last 24h and if yes for what kind of app?

I know Amsterdam startup http://www.silk.co has their entire backend written in Haskell. I'm not sure they deploy in weekends though.

Their CEO Salar told me that that, among other things, it gives them a hiring edge. People move to Amsterdam from all kinds of places just so they can write Haskell professionally.

As someone who moved to Amsterdam to write Haskell (and JavaScript) for Silk, I can confirm that the combination of a beautiful bike-friendly European city, a Haskell backend, and exceedingly cool co-workers makes for a very pleasant working environment.

I'm off on other adventures now, but I have no skepticism about deploying Haskell in production. Yeah, it's still a bit obscure, but if you're looking for smart and eager programmers, Haskell is good bait.

No we usually don't deploy in weekends. Only if we break stuff just before the weekend. :)

Indeed! So you didn't deploy Haskell in the last 24h so you don't count :-)

My impression is that there's nothing wrong with Amsterdam. Nice and liberal under a good state.

Not in the last 24h, but I pushed to production on Friday. We use Haskell at IMVU to power some of our web services and persistent stateful servers like the matchmaker.


I work for http://fynder.io - our entire backend stack is Haskell (libraries, PostgreSQL interface, email sending daemons, API server)

I have, for data-flow analysis software.

Haskell gets used in the oddest places, where one of two things is true:

    1. Nothing else works (with reasonable LOC *and* performance)
    2. The safety of an advanced type system is required
I'm not optimistic about Haskell appearing anywhere else for the time being, so I think it will stay an "exotic" language for awhile longer.

Facebook’s site integrity rules are written in Haskell (using Haxl: https://github.com/facebook/haxl) and are deployed every few minutes.

We use Haskell at SimplyRETS (https://simplyrets.com).

The core api service is written in Yesod and various other components are written in Scotty and WAI.

We use Haskell at https://www.frontrowed.com/ for most of our web applications, internal tools, email senders, API etc.

The Lamdu project I'm working on is in Haskell.

Our build system for a large C project at work is written in Haskell.

Various other tools we use (cgrep, resolve-trivial-conflicts, etc) are in Haskell.

Haven't pushed to the repo yet, but https://github.com/bluepeppers/highhockwho is my contribution :) Little tool to poll the docker daemon and push records to etcd in a skydns compatible format. In production, and seems to be fairly stable so far.

Ad traffic anit-fraud platform (api servers, data mining workers)

I recently launched http://geohangout.com. The entire backend service is written in Haskell (Yesod).

Our core services at https://circuithub.com is built on Haskell.

My company, FanJam.com, is built using Haskell for our backend stack & Ember on the frontend

I started the tutorial. Then I got stuck in the second step - Let's try something completely different. Type in your name like this: "chris".

The problem is: the input box doesn't get the quotes I write on my Mac. I tried double (") and single (') quotes

I found a bug in the tutorial that introduces map.

Typing in: map(+1) [1..5] won't advance to the next step (even though the interpreter handles it fine), but map (+1) [1..5] will (note the space after map).

The old site moved to https://wiki.haskell.org


Don't think the syntax examples on the main page are about teaching complexity. Try the wiki for that. E.g. https://wiki.haskell.org/The_Fibonacci_sequence#Naive_defini...

Looks neat, although I don't feel it's some big news. But there's some new weird font in "Haskell" logo now, isn't it?

Anyways, I'll always remember that cute cherry-flower (I guess) background on the old front page. It was nice first impression somehow.

It's a good start to make people want to try it out, but I feel the tutorial could go a bit further.. chaining functions together? defining functions? map functions and branching?

This appears to be broken in my browser. Screenshot: http://m.imgur.com/uXcS2ZS

Rakspace logo that appear on the footer should be light or white version, so it can match with the footer background

This redesign appears to take the position: the first page on haskell.org is for people who are brand new to the language, not for people who are already learning the language or currently use the language. I don't like that choice. I think the page should be trying to be the most useful for users of the language with a link to an About or Getting Started page that is geared toward new users. To me, a user of the language visits the site dozens or hundreds of times over the course of a career, while the average brand new user only visits it (I'm guessing here) 1.1 times. But I can appreciate the difference of opinion and priorities and from the creator's perspective I think the page does an ok job.

It makes me wonder though, what if news.ycombinator.com took that position. What if it were a page describing what Hacker News is, how posting and commenting and voting works, and how long the community had been around, etc. And then there were a link in a menu that said "Submissions" that took you to the actual content.

For someone currently learning the language (past the first 5 minutes) or that uses the language regularly, the only useful things on this front page are the four links along the top.

As for improvements, I think some sections (e.g. community banner) should be removed. I think the videos should, given the focus on brand new users, probably be removed too. The community banner is, I believe, only there to facilitate displaying the titles when people click on the videos. I haven't watched any of the videos, but from their titles I am skeptical that they should be watched before the next section (Features) is read, so they should, at a minimum, be moved further down the page. I don't like the alternating dark/light sections, so moving them further down would give you a more traditional dark header, light content, dark footer look.

I assume the videos are not going to change regularly, because they appear to all be from a single Vimeo account that has more recent videos than those that are displayed. If the videos are kept, I think the titles should be visible without clicking on the video, because I thought (which means some others will think) that clicking on the video would start playing it. Hovering one by one to see the title is not a good solution.

Congrats to the people who built and deployed this, I'm sure it took a long time to get it live (since I remember seeing this page hosted elsewhere many months ago).

> This redesign appears to take the position: the first page on haskell.org is for people who are brand new to the language, not for people who are already learning the language or currently use the language.

Correct! See here for a complete report on the motivations behind each design decision: http://chrisdone.com/posts/haskell-lang#the-audience

> To me, a user of the language visits the site dozens or hundreds of times over the course of a career, while the average brand new user only visits it (I'm guessing here) 1.1 times.

In practice this isn't true—it's generally agreed in the Haskell community: nobody goes to the home page, they go to either Hackage, Hoogle or google something and reach a page on the Wiki.

So basically you are saying "Don't be geared towards new users, because I am too lazy to set a bookmark to the pages I need and I want to save clicks..."

Obviously they want to stop any thoughts that haskell is a dated language, and they want to hook new people in at a faster rate.

Veteran users don't need any more encouragement.

The 'Click to expand' below each feature could be changed to 'Read more'.

Small thing but the favicon should be updated to look crisp on retina displays.

Huh, thanks for noticing. I have a retina display but on Linux Chrome and Firefox both ignore any kind of global font size settings for their tabs, so the icons are tiny and look crisp, didn't realise. That kind of thing bugs me too. The rest of the layout itself should be retina-friendly, though, as I developed it like that.

Yeah that is the only reason I mentioned it as the rest of the site was spot on.

Dam this is cool.

Nice new design!

"advanced" purely-functional. Does -advanced- actually means something?.

Two different unrelated adjectives: it's an advanced language, and a purely functional language

This is about https://news.ycombinator.com/item?id=7475631

You asked a year ago:

>You say it's used all the time -- so how about you give an example of a "lazy" solution to a problem in, say, C?

but I was just reading that old thread now, so replying here.

short-circuit evaluation would be an example in C, because the programmer can ask the compiler to do something, but at run-time it won't do it if the results aren't necessary - it just won't execute despite the programmer explicitly writing those instructions.

e.g. in the condition if (is_prime(a) && is_something_hard_to_compute(a)) then even though you're calling the function is_something_hard_to_compute() about a, at run-time if it's not necessary for the result, then purely out of laziness it won't get called. (i.e. if the first test returns false.)

this meets the condition you asked about.

reference: http://en.wikipedia.org/wiki/Short-circuit_evaluation

Yes. The type system in Haskell is leading edge. As in "advanced".

"Hi there, [name]! That's a pretty name. Honest. You're getting the hang of this!"

I fear that this style of childish and somewhat condescending tutorial content is becoming fashionable. Was it the best fit for the audience?

The tutorial is 5 years old, so I guess that makes me a hipster tutorial writer because I was doing it back when it wasn't fashionable? =p

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact