20 ms·
The New Haskell Homepage
- matchu 12y agoNeat! A nitpick: I haven't used Haskell, so I'm trying to read the prime sieve example in the corner, but there's very little contrast between the background and the nonalphanumeric characters. Some brighter syntax highlighting would be a better choice against that dark background.
- MBCook 12y agoAgreed. That punctuation almost disappears depending on the angle of my laptop screen.
- Touche 12y agoAlso maybe pick a simpler example and not play into the stereotype that Haskell is for people who think they are smarter than everyone else.
- vamega 12y agoCould 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 indeed simpler, it's a little nuanced in Haskell. Depending on how you're doing it you'll need to Map toUpper from Data.Char or use toUpper from Data.Text, and I don't think it's a good first impression have something that uses Data.Text, and the OverloadedStrings extension. PS - Although, I do agree with some other commentors here that this code isn't actually the Sieve of Eratosthenes, and is far more inefficient, and that is a valid reason to replace that example.
- tel 12y agoWell, for one, it's a bad sieve algorithm. I think a neat algorithm to demonstrate laziness and Haskell clarity would be enumerating the Calkin-Wilf rationals. [0] It's quite a bit longer but demonstrates a number of neat ideas. I'll start first with a derivation which demonstrates all of the structure of the algorithm and then go through a series of mechanical transforms so that by the end I have a one-liner and a comparable Python implementation. The first algorithm comes directly from the paper and uses an intermediary infinite tree to represent the rationals. data BTree a = Node a (BTree a) (BTree a) fold :: (a -> x -> x -> x) -> BTree a -> x fold f (Node a l r) = f a (fold f l) (fold f r) unfold :: (x -> (a, x, x)) -> x -> BTree a unfold f x = let (a, l, r) = f x in Node a (unfold f l) (unfold f r) breadthFirst :: BTree a -> [a] breadthFirst = concat . fold glue where glue a ls rs = [a] : zipWith (++) ls rs allRationals :: Fractional a => [a] allRationals = breadthFirst (unfold step (1, 1)) where step (m, n) = ( m/n, (m, m+n) , (n+m, n) ) In 16 lines I've got an infinite binary tree, its natural fold and unfold, a breadth first search, and a lazy algorithm for generating all of the rationals with no repeats. The whole thing is simple, natural, beautiful, and efficient! It demonstrates infinite recursive types, laziness, higher-order functions, and bounded polymorphism. And also a neat algorithm! The downside is that 16 lines is pretty long. By inlining the fold and unfold I can get it down to 9 lines: data BTree a = Node a (BTree a) (BTree a) breadthFirst :: BTree a -> [a] breadthFirst = concat . glue where glue (Node a ls rs) = [a] : zipWith (++) (glue ls) (glue rs) rats :: Fractional a => [a] rats = breadthFirst (generate (1, 1)) where generate (m, n) = Node (m/n) (generate (m, m+n)) (generate (n+m, n)) If I'm allowed imports we can use Data.Tree and make this a one-liner! import Data.Tree allRationals :: Fractional a => [a] allRationals = flatten (unfoldTree step (1, 1)) where step (m, n) = ( m/n, [ (m, m+n), (n+m, n) ] ) Finally, if I go another route and fuse the fold and unfold together into a hylomorphism data Trip a x = Trip a x x deriving Functor hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b hylo phi psi = phi . fmap (hylo phi psi) . psi allRationals :: Fractional a => [a] allRationals = concat (hylo glue step (1, 1)) where glue (Trip a ls rs) = [a] : zipWith (++) ls rs step (m, n) = Trip (m/n) (m, m+n) (n+m, n) we can hide the tree entirely and demonstrate `deriving`... at considerable cost to clarity! With a little more golfing (read: inlining) we arrive at this beauty: allRationals :: Fractional a => [a] allRationals = concat (go (1, 1)) where go = glue . next . step next (a, b, c) = (a, f b, f c) glue (a, ls, rs) = [a] : zipWith (++) ls rs step (m, n) = ( m/n, (m, m+n), (n+m, n) ) which at least has the bonus of demonstrating some nice co-recursion between go and next. Or even, ultimately: allRationals :: Fractional a => [a] allRationals = concat (go 1 1) where go m n = [m/n] : zipWith (++) (go m (m+n)) (go (n+m) n) which is actually kind of nice again if almost all of the structure has vanished. Note that if `interleave` were part of the Prelude then we could write allRationals :: Fractional a => [a] allRationals = go 1 1 where go m n = (m/n) : interleave (go m (m+n)) (go (n+m) n) given interleave :: [a] -> [a] -> [a] interleave [] ys = ys interleave xs [] = xs interleave (x:xs) (y:ys) = x : y : interleave xs ys which is a little prettier and directly comparable to something Pythonic like from fractions import Fraction from itertools import islice def interleave(x, y): while True: yield x.next() yield y.next() def all_rationals(): def go(m, n): yield (m/n) for v in interleave(go(m, m+n), go(m+n, n)): yield v return go(Fraction(1,1), Fraction(1,1)) def rationals(n): return list(islice(all_rationals(), n)) [0] http://www.cs.ox.ac.uk/jeremy.gibbons/publications/rationals.pdf http://www.cs.ox.ac.uk/jeremy.gibbons/publications/rationals...
- jlebar 12y agoFWIW I think the sieve is a great example. Fibonacci is trite and a toy, whereas this is nontrivial and shows off a lot of what's powerful about Haskell (infinite lists, list comprehensions, pattern matching with cons...). It's complex enough that it encourages people to stare at it for a few minutes and engage with it, which is also good. I vote to keep it!
- minikomi 12y agoI think it's fine, but could use an "explain" link like on the http://racket-lang.org/ http://racket-lang.org/ homepage.
- robinhoodexe 12y agoNice, I like it. Now, to actually learn the language...
- dllthomas 12y agoI recommend the IRC channel, the Haskell Cafe and Haskell Beginners mailing lists. People are helpful - talk to them. I understand the Haskell wikibook is also great at the introductory level.
- biscarch 12y agoThis will help: https://github.com/bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell
- wyager 12y agoLearn You A Haskell is a good book (and it's free online).
- akurilin 12y agoWould strongly recommend the #haskell-beginners channel on Freenode, it's there specifically to support people just starting with the language.
- codygman 12y agoWhoa, the change happened! My girlfriend and I both think it looks awesome :) Anyone know if there are plans to add the interactive/javascript examples as well? EDIT: Had noscript on, everything looks great.
- tieTYT 12y agoWow I've gotta say, this looks great. Something that bugs me is I couldn't copy the code in the upper right to the code "try it" section. I haven't used haskell for 6-12 months, so I'm not sure what I'm doing wrong. Here's a screenshot: http://imgur.com/N2SdFVq http://imgur.com/N2SdFVq Regardless of how to fix this, I think something should be changed so this can't be someone's first impression.
- codygman 12y agoIt doesn't seem to support function declaration.
- ingenter 12y agoYou can use function declaration in the same line it is used. `let { f x = x ^ 2 } in f 2`
- tel 12y agoIt's a somewhat limited shell. You can't make local definitions. Normally you'd do that using `let` in GHCi, but this prompt only evaluates expressions.
- misnome 12y agoThe box for "Try haskell expression here" is a little confusing, I tried to click on the white area to focus and didn't get any response. You apparently have to click on the same line, near the lambda symbol to focus? Edit: Additionally, I really miss the lovely download page http://www.haskell.org/platform/ http://www.haskell.org/platform/ - and the non-home pages feel a little underwhelming and underdeveloped in general.
- doctorKrieger 12y agolooks kinda generic but it's quite nice.
- dmytrish 12y ago"Try haskell expression here" + lessons is very nice. Just a little nitpick: λ map (+1) [1..5] can't find file: Imports.hs λ map (+ 1) [1..5] [2,3,4,5,6]:: (Enum b, Num b) => [b] though the first expression is what suggested in lesson 4. Edit: looks like some random bug.
- deleted 12y ago[deleted]
- msl09 12y agoyep, you are not the only one that had that problem λ foldr (:) [] [1,2,3] :: Num a => [a] λ foldr (:) [] [1,2,3] [1,2,3] :: Num a => [a]
- fleitz 12y agoI had similar issues with the first expression, sometimes when executing a new expression I also had to type it twice to get the answer.
- serf 12y agome too.. λ let (_,(a:_)) = (10,"abc") in a can't find file: Imports.hs λ let (_,(a:_)) = (10,"abc") in a 'a' :: Char
- IBCNU 12y agosexy
- rtfeldman 12y agoLove it! Looks like all that's missing are the "View Examples" links under the features. One note: the quick walkthrough mentions "up there" in reference to the repl, but the repl is actually to the left of that text when viewing on a non-mobile-sized screen. It should probably just not mention the relative positioning. I suspect Fibonacci would be a more familiar code sample than Sieve, no?
- deleted 12y ago[deleted]
- mark_l_watson 12y agoI like the look. A question: I have always used the "The Haskell Platform" download page and installer. The new download page looks like it is just Haskell, cabal, and default libraries. I am running ghc version 7.6.3 and cabal version 1.16.0.2. Haskell experts: should I do a fresh install? (I am on OS X and Ubuntu). Also, shameless plug: I blogged earlier today about using Haskell to access OpenCalais and the DBPedia SPARQL endpoint: http://blog.markwatson.com/2014/07/some-haskell-hacks-sparql-queries-to.html http://blog.markwatson.com/2014/07/some-haskell-hacks-sparql...
- jonsterling 12y agoIf you're on OS X or Linux, you should not use the Haskell Platform. It's a whole lot of pain for literally no gain...
- mark_l_watson 12y agoThanks Jon, I appreciate the advice. I am re-installing from haskell.org right now.
- majika 12y agoThe "Try It" section doesn't load without cookies/localStorage enabled. Having run-time state should be fine for tracking where someone is up to on the tutorial; persistent state shouldn't be necessary.
- weitzj 12y agoThe View Examples link seems not to work on iOS 5 with an iPad 3
- sampo 12y agoNeither on Firefox (default settings) on Ubuntu.
- cordite 12y agoThe "Try It" section really needs to have the text cursor be active anywhere I can click on the box to type. At first it made me think that I had to move over to the grey bracket-cursor (and thus a little frustrating/confusing/unexpected). Especially since I can click to the right (when the cursor is a normal pointer) and it gains focus. This page is strongly trying to convert a viewer, the experience can be smoothed here.
- tmslnz 12y agoTypo, missing to > You shouldn't have rewrite half your code base when it's time to scale.
- thoughtpolice 12y agoPlease note this homepage is NOT final and it's going to see revisions before we push it out to the actual website, including many tweaks to the content and probably some styling tweaks too. There are a lot of other things we still need to do as well, like ensure all redirects and subpages work properly. Source: I'm one of the Haskell.org administrators, and we pushed this out only today.
- coolsunglasses 12y agoThank you, this is the best present ever :)
- Pacabel 12y agoIs there a practical reason why there's so much empty space with this new design, and why so little valuable content and functionality is visible by default? Viewing the existing site in a desktop browser, I get to see the description of Haskell, and a bunch of useful links about learning it, downloading an implementation, using it, and participating in the community. Recent news items and upcoming events are also visible, as is the search field. This new design lacks pretty much all of that. Instead of useful content, links and functionality, all I'm seeing are large areas of purple and white, and an extremely blurry photo, along with content of very limited value. I just can't see this new design being beneficial in any way. It makes it much harder to get useful information about Haskell, which seems very contradictory to what a website like this should be doing.
- cordite 12y agoAnother 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 <- xs, x `mod` p /= 0] can't find file: Imports.hs
- deleted 12y ago[deleted]
- themodelplumber 12y agoI got that too. I was surprised to realize that I felt ready to completely give up on the language after seeing only that message.
- groovy2shoes 12y agoI 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 <- xs, x `mod` p /= 0] I tried to type it into the shell: λ primes = sieve [2..] <hint>: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 <- xs, x `mod` p /= 0] <hint>:1:8: parse error on input `=' Doesn't work. Now, I know enough about Haskell to know what I can and can't type into ghci, but what about people who are encountering Haskell for the first time? They'll try to run the given example in the "Try It" section and will get nothing but errors. Just my two cents. P.S. Is Haskell still avoiding success at all costs? (A philosophy I continue to be okay with, but it seems to getting futile :) )
- axman6 12y agoHaskell 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.
- rhapsodyv 12y agoMuch better! I hate the red links...
- jammmuel 12y agoI dislike this. Where is the 'call for me to do something'? Why are there blurred people on an escalator(?). Don't make me pick between concise and reliable. I'm more than willing to distill your messaging if it would help in any way. If only as an alternative.
- gipp 12y ago> Don't make me pick between concise and reliable. You missed the tongue-in-cheek, there. "Concise and Reliable: Pick Two." And those people are in a lecture hall. Under "Open-source community effort."
- austinz 12y agoI like the new site. It's beautiful and elegant. The weird flowers on the download page are gone. But the link to "Introduction to Functional Programming Using Haskell" takes me to the publisher page for the textbook "Aqueous Environmental Geochemistry".
- PeterWhittaker 12y agoWow, nice.
- ufo 12y agoIt bugs me a bit that the example code is brute force trial division instead of a true prime sieve. Sure, it highlights lazyness but the algorithm is less efficient. http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
- deleted 12y ago[deleted]
- bignaj 12y agoIf you ever wanted to know what a typical Haskell programmer sounds like, ^^this is it to a T.
- judk 12y agoNo, typical Haskell programmers avoid talking about performance issues, because those highlight how awkward it is to write high- performance code.
- ibotty 12y agothat's just nonsense. there are many people very concerned about performance. i guess you are right that some do not care about constant factors, but i am very sure most do care about algorithmic complexity. and thinking about it, that's the approach you should use for anything where every last bit of performance is not utterly needed.
- codygman 12y agoI'm a Haskell programmer and I care about performance. So do many others, which is why you continue to see things like Conduit and more recently Haxl.
- throwaway_yy2Di 12y agoWell it's the haskell.org landing page, of course they're showing off the type of code that Haskell is good at. In your link, the purely functional version (15 lines around a priority queue) is more complicated than a naive version with a mutable array, so why would they advertise it?
- Tyr42 12y agoI 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 http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
- judk 12y agoIt fits the tradition established by the quicksort that isn't really a quicksort.
- axman6 12y agoThat 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.
- eghri 12y agoExcellent! This is a big improvement. There seem to be some bugs with the "try it now" terminal, but it was easy enough that I actually gave Haskell a try after many years. It's got me interested enough to actually install it and start hacking away!
- k2enemy 12y agoGreat timing, as I've just started to explore Haskell in the last few days. First, I really like the style of the new site. My only gripe is that the section with the lecture hall photo and the videos right below it don't seem like an efficient use of prime real estate (and there is no context for the videos, I have no idea what they are or why I would want to watch it. The thumbnails suggest that I'd be clicking on an hour long lecture.). As a new user, I'd rather see the features in this space.
- elwell 12y agoI noticed as well that there was "no context for the videos".
- lallysingh 12y agoYeah, perhaps replacing those videos with a gallery of places to start learning. Website previews, book covers, etc.
- elwell 12y agoAn important addition to the Documentation section might be something about using Haskell for the web.
- pyed 12y agoThis design is beautiful and elegant, just like Haskell.
- euphemize 12y agoAwesome new look! I sort of have a thing for commas: An advanced purely-functional programming language An advanced, purely-functional programming language Much better, no?
- dragonwriter 12y agoDepends on the intended meaning -- if it is that Haskell is advanced among purely-functional programming languages, rather than both advanced and purely-functional among programming languages, then the former is far better.
- sordina 12y agoI'd either link from the heading, or add some variety to the "View examples" links. Possibly something like: * Show me a world without Null * How does Haskell help me scale? * When does less code give me more? * Take me on a tour of Hackage
- judk 12y agoThis would be a massive improvement.
- hss54 12y agoPlease, get rid off the primes example, as it is horrible inefficient (in the sense of, "Ok, let's find the first n primes by a simple well-known algorithm, like the Sieve of Eratosthenes") and a simple (non-pure) array-based approach will kick its ass. Such a toy-example just contributes to the wrong belief that Haskell is just useful in academics or teaching. Some time ago I did implement the sieve in several languages and I also considered Haskell but set for an unpure approach (IOUArray) and it was extremely fast (getting close to C/C++ and outperforming Go, Java, etc.). Obviously such an example is not good to present Haskell's novel ideas but this toy example is worse then no example. edit: Sorry, did not want to appear nit-picky, I like the language and the new design.
- exDM69 12y ago> Please, get rid off the primes example, as it is horrible inefficient (in the sense of, "Ok, let's find the first n primes by a simple well-known algorithm, like the Sieve of Eratosthenes") and a simple (non-pure) array-based approach will kick its ass. The primes example may be a bit awkward for people with no background in math but it's also an excellent example to demonstrate lazy evaluation in Haskell. The interesting bit is that primes is an infinite list, containing all prime numbers. Don't try to print the whole list or count the sum unless you have a computer with infinite memory :)
- Tyr42 12y agoIt's just as if you showed off insertion sort. Even if it looks good, it's not the best algorithm to show off.
- autodidakto 12y agoEven though it's a good example, I think extra care should be taken to avoid the stereotype that Haskell is elegant for math and academic stuff but not for the real word.
- pepper__chico 12y agoI'm in the process of finishing LYAH, and I'm also following CIS 194 which is available online (http://www.seas.upenn.edu/~cis194/ http://www.seas.upenn.edu/~cis194/, https://docs.google.com/file/d/0B0_mzHzbl3GbNXBWMVZPVGNtX3M https://docs.google.com/file/d/0B0_mzHzbl3GbNXBWMVZPVGNtX3M). I've learned about it from https://github.com/bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell. I think CIS 194 would be nice to be added in the book listing section? It's a great course with exercises and at the same time refer to chapters of both LYAH and RWH.
- Guthur 12y agoNatural, declarative, statically typed code. Not sure how that first adjective applies.
- jsmeaton 12y agoLooks like you're being downvoted, but I have to agree with you, especially given some of the examples right at the top. foldr (:) [] [1,2,3] There is absolutely nothing natural about that line of code unless you happen to already have some background. I executed that in the sandbox and got: [1,2,3]:: Num a => [a] And I still don't know what was achieved.
- daffodil2 12y agoFor a function f and a value x, foldr f x [a,b,c] gets turned into f(a, f(b, f(c, x))) '(:)' is list concatenation, so the result is 1 : (2 : (3 : [])) (Here we are writing list concatenation in infix notation, rather than the customary prefix notation). '[1,2,3]' is shorthand for 1 : (2 : (3: [])) in Haskell.
- jsmeaton 12y agoThanks, I appreciate the walk through. So it's essentially just copying an array (in this particular example). I'd still argue that the syntax is not natural - since you have to have specific knowledge of the operator and the function.
- tel 12y agoSyntactic naturality seems like it's mostly a function of familiarity. That said, the example has, for a lot of mathematical reasons, a great deal of semantic naturality. It's far from immediately obvious, but `foldr (:) []` is the way to copy singly-linked lists. In particular, if you look at a linked list as a degenerate tree then what `foldr f z` does is replace all of the nodes with `f` and the single leaf with `z`. Since cons, i.e. (:), creates a node and nil, i.e. [], is that single leaf then `foldr (:) []` is a very natural way to do nothing at all. So it's kind of the most boring interesting example imaginable.
- teamonkey 12y agoLovely page, but that primes example is going to put off more people than it attracts, IMO. If you're not familiar with Haskell, or functional programming in general, the syntax and concepts shown there would appear alien and obtuse.
- deleted 12y ago[deleted]
- tree_of_item 12y agoTitles for each of the videos would have been nice, just so I could get an idea of what I'm about to click on.
- X4 12y agoLooks really good, but as others noted, the examples should really work `as is` within the REPL. Also I think wikipedia has better example code. Everybody knows fibonacci and can compare it. Please add a nice Haskell facts and features tab, like: Appeared in 1990; 24 years ago More facts and features on: http://en.wikipedia.org/wiki/Haskell_(programming_language) http://en.wikipedia.org/wiki/Haskell_(programming_language)
- Camillo 12y agoThe downloads page is a bit too deemphasized; the big, bright Download button in the old page was a good call to action. However, I am really glad to see that the downloads page no longer recommends the Haskell Platform for OS X or Linux. I wish there were better free book recommendations on the Documentation page. LYAH's style is obnoxious, and RWH has gotten quite long in the tooth.
- mrspeaker 12y agoI agree about the download page being too subtle: I _really_ love this new redesign - the old site was impossible to figure out what I was supposed to do or what was going on or what the hell "cabal" was. This new site is clean and clear: but still missing a nice big call to action (besides the live coding part). Once you've looked at the live coding, the next thing is "community" which is great for docs, but not so great for "getting up and running" - which was also hard to figure out on the old site. I'd prefer to be lead from the live coding to clear instructions how to get Haskell running on my system. But, again - I love this redesign... great work!
- mintplant 12y agoThis appears to be a continuation of chrisdone's work on an "alternative Haskell homepage" [1], which was previously posted to HN [2]. [1] http://chrisdone.com/posts/haskell-lang http://chrisdone.com/posts/haskell-lang [2] https://news.ycombinator.com/item?id=7814354 https://news.ycombinator.com/item?id=7814354
- TuringTest 12y agoYes, the new page is signed by Chris Done at the bottom. I'm glad the Haskellers listened to his advice and accepted the proposed design; now it's time to tweak it with some real use.
- chrisdone 12y agoI didn't put that signature there, whoever deployed my repo did. I've asked several people to remove it.
- chewxy 12y agoI don't quite like this. The old one had front page links to the haskell wiki. This design is really information undense. Also, links to Hoogle and packages would be fantastic in the front page
- ufmace 12y agoWell, it sure looks nicer, I'll give you that. I'm more interested in the content, though. I was just trying here and there over the last week or so to learn some Haskell - people always seem to be raving about how cool it is. I found my way to the CIS 194 class link, the first one on the page, and I find that it really isn't very good for learning. I went through the first page, trying to run some of the stuff. I find that the syntax of the ghci REPL seems to have almost nothing to do with the syntax shown so far. Apparently, I have to use let for every variable, which was never mentioned, and there are lots of funny tricks for how to use multi-line stuff. I still have no clue how to actually write something, compile it, and have some sort of output in the main ghc compiler. Is there a tutorial anywhere that actually helps you learn the language through doing useful things, instead of throwing a bunch of syntax that you can't do anything with at you? Speaking of tutorials, the old page links to like 500 of them or so. I have no clue how to figure out which one to start with. If you're re-doing it, please link no more than 3 learning pages, no matter what. Have the rest in some buried page somewhere if you must, but keep the front page manageable. How is anybody supposed to make sense of however many tutorials and courses you guys have linked on the old one? I gotta figure I'm the prime audience for this stuff, but I have no idea where to start on your current page. While I'm at it, can anybody recommend something like a step-by-step thing for people who are proficient in several other languages, but have never seen any Haskell before? Like where every little step has something you can actually type in, run somewhere, and get some sort of output?
- berdario 12y agoI suggest you enable the `+m` flag for multiline input This way, you don't have to use the weird curly braces trick (which I always forget), at the cost of having to type one more enter when entering a oneliner FYI, this is my ghci.conf: https://github.com/berdario/dotfiles/blob/master/ghci.conf https://github.com/berdario/dotfiles/blob/master/ghci.conf (I don't suggest a new user to use ClassyPrelude) That said, I'm not sure what learning material to suggest to you, but if google and stackoverflow.com fails you, try freenode#haskell personally, I got a lot more interested in Haskell after starting with Clojure (it helped me to appreciate more things like immutable data structures)
- forrestthewoods 12y agoI 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 : sieve [x | x <- xs, x `mod` p /= 0] Jesus. Where to begin? First of all I had to consult a dictionary for sieve. I guess primes is a thing (function?) that takes 2 or more things? Not sure. Not sure what 'where' means in this context. Don't have a good guess. Have absolutely no fucking clue what "p:xs" means. Also no idea what "p : sieve" means. I am equally stumped as to what "[x | x <- xs," means. The "x 'mod' p" I can guess! The /= 0 I'm not sure. Maybe "/=" is equivalent to "!=" ? And here's the thing. I've tried to read a dozen or so tutorials on Haskell and I give up every time because the syntax isn't explain. Please, please for the love god just tell me what your abstract symbols represent! Edit: http://learnyouahaskell.com/ http://learnyouahaskell.com/ Reading that now. So far it's pretty good.
- okasaki 12y agoI wrote a page that tries to explain the syntax in a way that's appropriate for programmers (who don't need to be shown how the REPL can be used as a calculator and things like that): http://dv.devio.us/a-quick-look-at-haskell.html http://dv.devio.us/a-quick-look-at-haskell.html
- blitzprog 12y agoReading it right now, really great - thanks!
- berdario 12y agoNum a => a is actually (Num a) => (a) that is, Num a means roughly something like template<class a> class INum{ } `a` is an instance of `Num` if you want to write a times2 function(f(x) = x*2), its type would be (with redundant parenthesis added) (Num a) => (a -> a) so, a->a means it's a function that takes an `a` and returns an `a`... and `a` can be any thing that implements Num The idea with haskell is that you heavily rely on polymorphism on the return types, this might make using code a little more awkward, since you have to explicitly say the type that you want to constrain to, but it makes writing generic libraries/APIs a lot easier, you might find this question interesting: http://programmers.stackexchange.com/questions/105662/is-return-type-only-polymorphism-in-haskell-a-good-thing?rq=1 http://programmers.stackexchange.com/questions/105662/is-ret... `[2..]` is the same thing as itertools.count(2) in Python, an infinite sequence of number, starting from 2 sieve something where sieve (p:xs) = yadayada is usually written on multiple lines sieve something where sieve (p:xs) = yadayada if you know that you can define a function with f x = something_with_x it's somewhat obvious that you're defining a function called sieve that takes a (p:xs) so, you're just defining a function and using it (with the [2..]) argument on the same line (p:xs) is destructuring, it basically take a list (`(:)` is used to `cons`truct lists) and assign the first element of it to `p`, and the rest to `xs` (xs is a commonly used name for this in Haskell) so, it's like calling sieve(list); but you can define its signature as something sieve(T head, list<T> rest); (`something` will turn out to be `list<T>`) /= is indeed the same as !=, so (x `mod` p /= 0) is just (x is not a multiple of p) [x | x <- xs, x `mod` p /= 0] is a list comprehension, and is taking all the elements from xs that aren't multiples of p p, as suggested by the letter, is a prime... so you're recursively filtering the elements who are not multiples of p, leaving only the ones who are multiple only of 1 and p themselves (that is, primes) finally, you're concatenating the prime you're currently acting on (p) with the infinite lazy list of all subsequent primes Hope this helps
- sreya 12y agoI 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?
- ibotty 12y agohaskell can be used for pretty much everything (even hard realtime with a code generating dsl called atom), so just think about what you enjoy/like and maybe ask before for pointers to libraries you might use with that task. if there is anything you like but is algorithmically challenging, all the better. it's very nice to express math in haskell.
- wfbarks 12y agonot at all surprised that the first code sample is A) Cryptic as hell and B) Something I basically never need to do when developing an app
- slashdotaccount 12y agoUgh, doesn't use progressive enhancement: https://en.wikipedia.org/wiki/Progressive_enhancement https://en.wikipedia.org/wiki/Progressive_enhancement
- VMG 12y agoHow would the REPL look like with progressive enhancement? "Thanks submitting a Haskell line! You're being redirected to the output of the evaluation. If you're not being redirected automatically, please click _here_"
- basicallydan 12y agoI used to hate Haskell at University, until the final couple of weeks of the module when I started to "get" it. After that, exams and dissertation (which was in Python) got on top of me and I never revisited it. Now, coming back to it I am starting to remember the fun I had :)
- rcarmo 12y agoScores high on layout, not so much on usability (I, too, took a while to realize there was a live REPL on the page) or readability. (I'm one of those people who tried to learn Haskell a couple of times but lacked use/time to really get to grips with it, so I can actually parse some of it, but the samples ought to be simpler.)
- 72deluxe 12y agoIt's pretty! BUT! I get the feeling that I am viewing websites through a post box slot. This seems to be the trend with currently fashionable sites, with the wall to wall slot appearance.
- skratlo 12y agoPlease, can anyone come up with something original? Or at least usable.
- cpplinuxdude 12y ago"You shouldn't have rewrite half your code base".
- oneandoneis2 12y agoA few thoughts: It's really distracting that typing in the REPL changes the size of the containing div. The blurry photo of (I assume) the audience of a lecture just doesn't work - what's it supposed to do? There's very little useful information - everything is at least one click away. If the whole purpose of the site is to 'sell' to a new audience then I guess that's not an issue, but I expect to be able to go to the site of a language & get very quickly and easily to useful manual/wiki pages explaining whatever feature I'm having trouble with. The basic style is very 'modern' but it looks more like a Kickstarter page that's there to sell you something trendy and new than the front page of a site giving you information about a language. It's very pretty but (to me) sends completely the wrong message about what this site is.
- Torn 12y agoAlso typing in their code example (the one right at the top, pride of place) into their 'Try it' repl throws an error: primes = sieve [2..] where sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0] <hint>:1:8: parse error on input `='" error Now I have almost no knowledge of Haskell, so I'm probably making some really basic mistake, but I figure most visitors will try that and then get put off
- thomasahle 12y agoYes, that's certainly an issue. In fact the "Try it" box also seems to work differently from the standard haskell live interpreter, in which you'd be able to define functions by prefixing them with 'let '. If you still want to try it out, say let sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0] in sieve[2..]
- Osmium 12y ago> The blurry photo of (I assume) the audience of a lecture just doesn't work - what's it supposed to do? It has links to a bunch of lectures/videos right below it, so I'm guessing that's why it's there...
- asgard1024 12y agoI think Haskell deserves a concise, functional homepage. Ideally, without any side effects (like animation). Every URL should always return either the same content, or an appropriate monad.
- denibertovic 12y agoI like the new homepage. One little nit-pick, I actually find the quicksort example a better candidate (instead of the sieve one). I think it highlights the expressiveness of the language a lot, and everybody implemented quicksort in some other language at one point, so they can compare.
- progman 12y agoMany people know C++ and Java but have no sense for functional programming. It would help them to read equivalent known code to compare it with Haskell. For instance FP Complete's Introduction to Haskell presents some ugly Java code which can be written in two elegant lines in Haskell (video around 03:25 min). http://www.youtube.com/watch?v=Fqi0Xu2Enaw http://www.youtube.com/watch?v=Fqi0Xu2Enaw
- thomasahle 12y agoA video like this could also be cool to have on the front page.
- sparkie 12y agoThis gets brought up often, but side-by-side comparisons don't really work, because the languages are too different for them to be meaningful for anything but trivial expressions. To really understand Haskell, you need to somewhat unlearn Java - or at least, stop thinking in it (in terms of objects, state and method calling). I think a good approach to thinking differently is to look how data structures are done - most programmers recognize arrays, lists, stacks and queues, but might be confused as to how you would implement such thing without side effects. A great resource to explain this is Okasaki's Purely Functional Data Structures[1], although it doesn't use Haskell at all, the ideas are relevant, and you can work through all of the examples implementing Haskell equivalents. [1]:https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
- pka 12y agoI started doing a redesign some time ago, but never finished it [1]. https://dl.dropboxusercontent.com/u/30225560/poc-haskell.png https://dl.dropboxusercontent.com/u/30225560/poc-haskell.png
- mimog 12y agoI like how it says "Rock-Solid Ecosystem", yet I have had the exact opposite experience trying to install even the most basic things with Cabal. I still can't get the Sublime text haskell plugin to work due to a dependency that fails to compile.
- rhizome31 12y agoI had a similar experience with Cabal. On one computer I haven't been able to install Yesod whereas on another one, it finally worked after I had wiped my ~/.cabal. It gave me the impression that Cabal's dependency resolution mechanism is still a bit britle. Also I found that installing stuff through Cabal was pretty slow. It's probably partly because Haskell libraries tend to be kept narrow in scope so it's necessary to install a lot of small packages to get a piece of functionality (take for instance the dependency list of Aeson, which seems to be the recommended choice for working with JSON : http://hackage.haskell.org/package/aeson http://hackage.haskell.org/package/aeson ). Another reason is that Cabal compiles Haskell code into native code.
- brianbreslin 12y agoWould love to see a " this is where to use Haskell and why guide" just something a novice can see and say "oh this is why I should learn this instead of x"
- moron4hire 12y agoThe very first example I see, the infinite sequence of primes, seems to indicate it is Eratosthenes' Sieve, but it is not. http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf In fact, the correct implementation, with some discussion of the bad performance characteristics of the example on the front page, is in your own wiki: http://www.haskell.org/haskellwiki/Prime_numbers#Sieve_of_Eratosthenes http://www.haskell.org/haskellwiki/Prime_numbers#Sieve_of_Er... Reading further, it looks like it is the correct implementation of "Turner's Sieve", but I don't think (though I may be wrong) that I'm in the minority that sees "prime" and "sieve" and thinks "Eratosthenes".
- Folcon 12y agoJust trying out the tutorial: there may be an error on step 11. followed the instruction to type out 'a' : [] and got: λ 'a' : [] can't find file: Imports.hs It worked when I clicked on the command, but that may not be obvious to a new user. λ 'a' : [] "a":: [Char]
- wcauchois 12y agoIf the interpreter isn't going to work on mobile, you should hide it.
- sparkie 12y ago> How often do programs crash because of an unexpected null value? Haskell programs never do! > head [] error "Prelude.head: empty list" Ok, so you don't call it `null`, but it still crashes the program. Its deceptive to claim null isn't present because it's conventional to avoid using "error" in favor of Maybe, but it's still there, and used throughout Prelude. The REPL on the site hides these errors too, which is going to be pretty confusing to a newcomer who takes the head of the empty list and gets back "null" (the absence of a value) of type a. > (head x) + (head (head x)) :: Num a => a Hiding errors makes it hard for a beginner to see what went wrong, although perhaps not in this trivial example.
- wtetzner 12y agoThere's a difference between crashing and returning null. If head returned null on an empty list, that null could be passed around to different places in the program before it crashed from a null pointer exception. There can be unexpected crashes in Haskell, but not because of null.
- sparkie 12y agoIt's not equivalent to null, but analagous to it. With lazy evaluation, I can pass also around the expression `head []` to different places, and it won't complain until I attempt to evaluate it - much like a language with null won't complain until you try to dereference it. Sure there's a difference though - you can see immediately where the problem is with Haskell's error, but it's more difficult to trace why a value might be null in imperative code (Which I think has more to do with mutability than the presence of null). I was also highlighting that the tryhaskell REPL actually behaves like null, because it doesn't terminate immediately as you would expect. Just yesterday I was discussing this topic with the author of the Mars language, because his record implementation is equivalent to Haskell's and is flawed in the same way (sum types + records leading to what is effectively the equivalent of `null`) [https://news.ycombinator.com/item?id=8005116 https://news.ycombinator.com/item?id=8005116]. Given a new language like Mars, he could provide a fix, but we have too much baggage to break Haskell's implementation.
- wtetzner 12y agoThe site feels too flashy, and the giant photo feels distracting. It would be nice if it felt "cleaner." As it is, I feel like a newcomer would find it somewhat overwhelming visually. I think something nice and simple like Rust's homepage[1] would be nice. Or maybe something like Racket's homepage[2]. [1] http://www.rust-lang.org/ http://www.rust-lang.org/ [2] http://racket-lang.org/ http://racket-lang.org/
- anoxic 12y agoJust a nitpick: Why don't you stay consistent and use Open Sans for all the main text and the logotype at the top. Having "Haskell" in Ubuntu when the rest of the site is not stylized like that looks a little silly.
- mike_ivanov 12y agoThis page would seriously benefit from a few random kitten pictures.
- new_test 12y agoOff-topic: I want to learn a functional programming language, and I was thinking to go with Scheme (because, you know, SICP...) Would there be any advantage for me to go with Haskell instead?
- stan_rogers 12y agoPerhaps, but it wouldn't hurt to pollute your mind with SICP first. At least watch the Abelson/Sussman videos (an accelerated version for HP employees); the audio sucks on a couple of them (I mean, in a couple of the lecture videos the audio sucks with much greater force than it sucks in the rest of them, but it's still not quite as bad as Feynman's Robb lectures), but it's a small time sink for a lot of enlightenment.
- thinkpad20 12y agoScheme and Haskell are very different languages. Both are functional, but that's about where the similarities end. Scheme is impure, haskell is pure; scheme is strict, haskell lazy; scheme is dynamically typed, haskell static; all functions in scheme are variadic, all in Haskell are unary; etc. So it depends on what you're looking for, and what you're trying to use it to do. That said, here are some advantages of Haskell: 1) Speed. Haskell binaries are highly optimized and tend to be very fast. 2) Correctness. Haskell's type system is far more advanced than any other language with as much or more usage, and is very good at preventing runtime errors. (and can go a long way to preventing logic errors). Also, its purity prevents huge classes of bugs. 3) Interesting: Haskell introduces a lot of new concepts which can really open up your understanding of computer science. It's a lot of fun. 4) Forward-looking: many of the ideas introduced or popularized by Haskell, such as pattern-matching, type classes, no null pointers, etc, are manifesting themselves in the new languages these days (such as Rust and Swift). Haskell itself is also (slowly) making its way into industry. Learning Haskell, in some ways, exposes you to the "next generation" of languages and programming techniques. I'm not sure the same can be said of Scheme, which tends to be used pedagogically more than as a means to push the envelope. Then again, I know Haskell a lot better than I know Scheme, so maybe I'm biased. But at least, it gives you something to think about.
- 12y ago
- rcconf 12y agoI find the disappearance of the Haskell text and logo in the navigation bar to be really strange. It feels like I'm going to a completely different website every time I click anything on the menu. I think it should always stay there, or something else should be done entirely.
- cweathe2 12y agoHow did it know I was 28??? ;-)
- protez 12y agoI love Haskell and OCaml, and other functional languages. However, no matter how intelligent and higher-level functional language becomes, I don't think they can replace procedural language, especially for time-based programmings, such as user interface effects, animations, or network-dependent operations. Some features are inherently procedural by their nature, and functional language are not functional for describing them.