Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My problem with Haskell, coming from the ease of Lisp, is that so much of the syntax is symbolic!

I know mathematicians might love it, but forgetting a symbol can mean I don't understand an entire block of code. Whereas it could have been made so much clearer with one word.



Well, there’s really only a handful of operators in typical code that don’t appear in other languages, and these are bound to the standard abstractions (functions, Functor, Applicative, Alternative, Monad, Monoid) that are used all the time. Once you learn those it’s pretty much smooth sailing, but yeah, it was pretty daunting to me at first, and even now as an experienced Haskeller I don’t care for packages like Lens that can turn into operator soup.

However, I do think the built-in symbolic syntax (::, ->, =>, =, |) is all pretty clear. And thankfully there’s Hoogle to find the meaning of any operator you don’t understand, or even to find a function that you think should exist of a certain type. So I dunno, we get by well enough. And you could actually write your code largely without operators if you wanted to, either because there’s a standard name already, or because it’s easy to define an alias.


Could you give an example of this? I don't quite follow what you mean by "symbolic syntax". Do you mean infix functions like >>= and <$>?


Syntax where symbols are used in leiu of words.

For example, I have no clue what >>= and <$> mean from a glance.

I have to look it up to get Monad and Functor. Why not use the word?


Well, because it's pretty obvious after you've spent a week with Haskell. With that said, one thing the Haskell creators seem to regret is not requiring every operator to also have a name. (In the case of <$> it does: fmap)


As far as I can see, if you already know what fmap does and what infix notation is, you'll know what <$> is after looking it up just once. And if you know what a monad is, you'll also know what >>= does. And if you know neither of these things, then I'm fairly sure writing `fmap` and `bind` wouldn't help much anyway.




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

Search: