←back to thread

306 points jameshh | 1 comments | | HN request time: 0.211s | source
Show context
behnamoh ◴[] No.44409423[source]
Haskell has an interesting syntax: it is intuitive after someone explains it to me, but not intuitive much before the explanation.

I don't think it's because I'm used to Algol-based languages (C, Python, etc.). Every Haskell code I've seen is plagued with a plethora of operators which aim to make the code concise but it's not obvious what they do just by looking at them: https://academy.fpblock.com/haskell/tutorial/operators/

replies(4): >>44410370 #>>44410421 #>>44410532 #>>44411932 #
theLiminator ◴[] No.44410370[source]
> it is intuitive after someone explains it to me, but not intuitive much before the explanation

Isn't that pretty close to what something being intuitive means? Ie. something being intuitive means that it's easily understood or learned without requiring prior knowledge or instruction.

replies(1): >>44411661 #
1. gylterud ◴[] No.44411661[source]
With Haskell code it is often so that the code which actually does something is expressed in terms of combinators. These combinators are often very general, so one must do a bit of mental work to understand what they do in this particular context.

Once you understand what the combinators do in a particular context the code often reads very easily, and what it does is very intuitive and natural.

Best example I can think of is applicative parsers, where there are scattered <*> and <$> operators around, but if you just ignore them the parser just looks like a very intuitive description of what the expressions you want to parse look like.