23 ms·
The fact I read this and have absolutely no idea about what's going on makes me compelled to learn more about Haskell. Is it really that alien (I know Scheme)?
by hcarvalhoalves 13y ago
The fact I read this and have absolutely no idea about what's going on makes me compelled to learn more about Haskell.
Is it really that alien (I know Scheme)?
- chc 13y agoIt's pretty weird. It's a very strongly statically typed lazily evaluated pure functional language with a type system that is actually Turing-complete.
- njs12345 13y agoThe type system isn't Turing-complete by default, you need to enable a fair number of extensions: http://www.haskell.org/haskellwiki/Type_SK http://www.haskell.org/haskellwiki/Type_SK
- njs12345 13y agoHaskell is definitely pretty far away from almost any other language (I can't think of any others which are lazy by default, for example). Learn You a Haskell is probably the best resource if you want to take a look, although it seems to be down right now: http://learnyouahaskell.com/ http://learnyouahaskell.com/
- gtani 13y agoNot alien, but not like ordering a sausage mcmuffin for breakfast. You'll recognize ideas taken from haskell (list comprehensions, especially) in other languages but the function definitions (multiple pattern matching clauses/"equations"), may be alien, unless you've looked at erlang, F#, ocaml, scala or some such. You could look at these to get why http://www.haskell.org/pipermail/haskell-cafe/2012-June/101558.html http://www.haskell.org/pipermail/haskell-cafe/2012-June/1015... https://www.fpcomplete.com/page/case-studies https://www.fpcomplete.com/page/case-studies http://elaforge.blogspot.com/2011/07/what-haskell-doesnt-have.html http://elaforge.blogspot.com/2011/07/what-haskell-doesnt-hav... http://haskell.cs.yale.edu/?post_type=publication&p=112 http://haskell.cs.yale.edu/?post_type=publication&p=112 http://www.jerf.org/iri/post/2908 http://www.jerf.org/iri/post/2908 (or a few dozen tutorials: http://haskell.org/haskellwiki/Learning_Haskell http://haskell.org/haskellwiki/Learning_Haskell ----------- here's my attempt at organizing the learning process (having lots of places to ask questions (SO, reddit, beginners list, G+) is great http://www.reddit.com/r/haskell/comments/1b7axp/haskell_homework_helptutor_wanted/c94hvr1 http://www.reddit.com/r/haskell/comments/1b7axp/haskell_home...
- GrandTheftR 13y agoI have been programming Haskell for the last few month for a sideline project, and really enjoying the experience so far. This has been the second or third time I revisit Haskell as a programming language, and this time I do feel that I am "getting" it in Haskell and could be productive ;) and I do feel very safe to write in Haskell, usually it works if it compiles. Here is one great post about starting in Haskell (via jerf@Reddit) http://www.reddit.com/r/haskell/comments/1e3cl0/haskell_intuition/c9wkwev http://www.reddit.com/r/haskell/comments/1e3cl0/haskell_intu... it would be the exact way if I would summarize my experience over last few months.. but I do feel the lacking of good communicators in Haskell community who know how to talk to non-Haskeller.
- lobster_johnson 13y agoThat Reddit post is great. For me, in learning Haskell, the biggest challenge has been libraries. Many of them just seem badly designed, or unfinished. My first project I wrote a simple scraping tool that scrapes a certain web site and organizes the information in a database behind a front end and API. Immediately I encountered several problems that would have been a cakewalk in, say, Ruby: * The HTTP library (Network.HTTP) is not encoding-aware. It ignores Content-Type and returns a String with some undefined encoding. So if you grab a resource which is, say, ISO-8859-1, anything that works with UTF-8 will potentially blow up. * (And if you do this yourself, there is no built-in way to parse MIME charsets into Haskell encoding names except by writing it yourself, I think.) * The string libraries are confusing. There is String, but also Text. Both are supposed to be Unicode-aware, but many of the operations you want are in Text, requiring conversions back and forth. * I could not, and still haven't, figured out how to convert a ByteString containing ISO-8859-1 to an UTF-8 string. Data.Encoding apparently exists for that, but I could not get it to work like I wanted. I ended up with this lovely mantra (which you wouldn't think had anything to do with ISO-8859-1, but it does) and left it like that just because it works: decodeLatin1 bytes = Data.Text.unpack $ Data.Text.pack $ Data.ByteString.Char8.unpack bytes * There are multiple libs for HTML/XML parsing, and no clear winner. HaXml was buggy and did not parse my HTML correctly. TagSoup and HandsomeSoup had weird APIs I did not like. I ended up with HXT, which uses Haskell arrow syntax extensively and is therefore incomprehensible, even when I understand what and how it does it. It feels a lot like people who write ambitious libs in Ruby with too much "magic". Haskell is a functional language and should be wonderful for parsing HTML/XML using XPath or CSS selectors, but it's a nightmare. HXT's parser is impure by default (!) and you have to google some tutorials to find out how to use its pure version, which the tutorial writers (in the same breath) dissuade you from using. * For the frontend I ended up using Happstack Lite because it's small and about as easy to get started with as Sinatra. Unfortunately, the first templating system it recommends, Blaze, is crap. With Blaze you write the template inline, building an XML tree, similar to Ruby's "Builder" gem, but the syntax is ugly and unnecessarily complicated. The other recommended templating systems, HSP and Hamlet, are like ERB or PHP, so a serious step backwards from HAML. In the end, I could not find anything like HAML. * I haven't delved very deeply into Happstack yet, but like many Haskell libs it seems to make simple things more complicated than they ought to be (eg., the routing system). One annoyance I remember is the fact that HTTP verbs aren't IO, which makes code less intuitive, since obviously in a modern web app, HTTP verbs are going to be doing IO (things like talking to databases), and so you have to use liftIO a lot. * Perhaps the biggest issue for me was the general lack of high-quality documentation (Happstack itself has almost none). Sure, there are tons of searchable machine-generated docs, which is great, but that documentation lacks the bits that tie everything together. Since Haskell is mainly about applying functions to values of types, it is very decentralized; knowing what function to use is only part of the game. It's just as important to know how its return value plays with the rest of the function space, because so much of Haskell revolves around composing functions in idiomatic ways. This is very different from, say, Ruby, where you know a method returns an object, and an object only has the methods its class provides; this centralizes, clusters and constrains the information into easily digestible pieces. A veteran haskeller would probably not struggle too much with these things. But as a novice, I expected the path to be slightly easier. The language was rarely a problem, the libraries definitely were.
- Tyr42 13y agoIt's not that different from Scheme, really. If you are only using lists of one element type, then most scheme code translates fairly naturally to Haskell. Sure you use a `case _ of ...` instead of a `cond`, but Scheme is more similar to Haskell than it is to Python for example.
- lobster_johnson 13y agoThe slides are admittedly fairly obtuse, with very little context. Presumably there's an accompanying talk we are missing. Haskell is really not alien. The stuff that usually comes up, such as discussions about monads, make the language seem weirder and more esoteric than it really is. The base language, if you disregard the more advanced, complicated topics (for example, the mathematical basis for monads), is very straightforward, although some of the concepts (typeclasses, lazy evaluation, partial application/currying) can seem very novel and strange and daunting if you are not used to ML-based languages. I was not, and I had no problem grasping the basics, although I am still not fluent in the more complicated monad-based stuff. The best intro, by far, is Learn You A Haskell For Great Good! [1]. It starts very gently, and is tailored to people who are more familiar with current imperative languages. [1] http://learnyouahaskell.com/ http://learnyouahaskell.com/