Also as someone who doesn't know Haskell at all, I have great difficulty reading Haskell. I dont think I would have that kind of problem reading a language with a more traditional syntax.
"do", "let", "where", "case", "class", "instance", records, ...
There's a lot more syntax to learn than in Lisp, but it is IMO the best designed syntax of all languages I've used prior to Haskell. It is much less noisy and less painful than the C-family syntax.
I do remember it being so different was an obstacle for the first couple of weeks of learning Haskell, and even being grumpy about "why did they have to choose a syntax so foreign" at that point :)
It is generally an actually designed syntax and works quite well. My point was that most of the unusual things are just function calls.
I find a lot of people complaining about Haskell syntax without understanding how deeply different this language is from "usual" languages.
This would remove a significant portion of the $ signs in Haskell programs, as so many of them are just padding for "do", "case", etc.
I know them now, but discoverability is pretty low on those functions.
Now the structure of Haskell is going to be very alien if you're used to imperative languages (C, Python, what have you). You mention Lisp, so that should give you as good a background as anything else in terms of reading Haskell code.
Right, but then you'd lose the benefit of Haskell being a very different language. To implement Haskell using C-style syntax would make it extremely awkward to make liberal use of Haskell's powerful features. In particular, Haskell's syntax is optimized to make fully/partially applying functions as quiet as possible. This really shines in conjunction with the ability to define your own operators -- including their fixity -- so you can wage an all-out assault on parentheses!
(defun foo (ls)
(mapcar (lambda (x) (+ (f x) 2))
ls)))
Trim unnecessary parenthesis (map is mapcar, \x -> … is lambda expr): foo ls =
map (\x -> ((+) (f x) 2))
ls
With infix syntax foo ls = map (\x -> f x + 2) ls
And only if you really want it: foo = map (\x -> f x + 2)
foo = map ((+2) . f)Personally, I'm with you. I've used other functional languages (F#, clojure, erlang), I'd say I'm pretty familiar with a lot of the ideas Haskell uses (comprehensions, partial application, anonymous functions, pure functions, pattern matching) and I actually really want to learn Haskell, but I have a hard time intuiting the meaning of a lot of Haskell syntax just based on other syntax that I know.
I also realize that the syntax probably fits the language very well, which makes sense, and that it's a good thing. I wouldn't want it to compromise it's purity for familiarity. Just makes it more work to learn.
My view of Haskell is the same as a non-Lispers view of Lisp. Cry about too much parens and it making things difficult to understand. Doesn't mean the language needs to be changed. I am all in for learning Haskell although most introductions to haskell are really time consuming and dense, so I never just did it. Which is where I was really glad that this tutorial was put up.
Hating any language which actually does serve its purpose is pretty stupid. If anyone actually has some issues understanding a sightly different but very well respected language, then the fault is mostly with that person and not the language.
When I first started learning lisp, the syntax was foreign, and while lisp syntax is arguably really really simple, composition with that syntax is a little weird if you're not used to it. Yet, at the same time, the syntax is a fundamental part of the language, especially with respect to homoiconicity, simplicity and macros. It was a time-sink to get used to it, but totally worth it.
It concisely covers most of the syntax and some common idioms with prelude functions (such as using `$` and `.` to get rid of parenthesis)