News for hackers. Stuff that matters.
Re:Introduction to Functional Programming in OCaml by akavel on Thursday August 23, 2018 @11:52AM (#17828276)
For me personally, the proliferation of custom operators/syntax is a serious obstacle. When reading, I seem to need to "hear/speak" what I'm reading in my mind, and seeing a line of operators that I have no idea how to read/spell "aloud" (and thus remember, even if I manage to find their definition, which is non-trivial too), cripples my mind and renders me unable to comprehend what's going on in the code.
Re:Introduction to Functional Programming in OCaml by hellofunk on Thursday August 23, 2018 @03:06PM (#17829784)
This was my #1 turnoff for Haskell as well. All these operators and functions, each with possibly varying precedence as well as different fixities. I was constantly having to lookup how the function was actually being called -- which of its surrounding entities were a part of the function call, and in which order did the calls take place? In addition to this complexity, the functions are often cryptic little characters (operators) that just make the readability worse. Programming languages should make our lives as developers easier, right?
Re:Introduction to Functional Programming in OCaml by k__ on Thursday August 23, 2018 @11:54AM (#17828296)
Yes, this was a huge problem for me too when I tried to learn Scala.
Re:Introduction to Functional Programming in OCaml by shados on Thursday August 23, 2018 @04:47PM (#17830579)
Ding ding, we have a winner.

A lot of languages support custom operators, but some really abuse the hell out of them. Googling for <%-/\-%> is very difficult.

Re:Introduction to Functional Programming in OCaml by tylerhou on Thursday August 23, 2018 @05:29PM (#17830846)
But you can always Hoogle for them: https://www.haskell.org/hoogle/?hoogle=%3C%24%3E
Re:Introduction to Functional Programming in OCaml by akavel on Friday August 24, 2018 @02:39AM (#17833207)
Oh!

So, first of all, I didn't know about this site, and actually it could have helped. I wish it was mentioned early enough (e.g. when first operators are introduced?) in the tutorial I was reading (Learn You Some H.? Not sure, don't remember now.)

Secondly however, I see it still doesn't mention how to spell the operator. Though I suppose in this particular case "fmap operator" could be acceptable?...

edit: Eh: see for example '>>=' and '>>'. Based on the docs, I could only try to call them both "compose", but they need some differentiation in my mind...

Re:Introduction to Functional Programming in OCaml by tylerhou on Friday August 24, 2018 @01:06PM (#17836188)
Yeah, the first one is called `bind`. The second one is a variety of `bind`. But you can just lookup the symbol in Hoogle and it will give you the definition.

You can also lookup a type signature and Hoogle will give you all functions for that type signature. For example, there is only one total function `(a -> b) -> [a] -> [b]` (map) and if you search that Hoogle will show you map, accordingly: https://www.haskell.org/hoogle/?hoogle=%28a+-%3E+b%29+-%3E+%...

Honestly Hoogle for Haskell is better than Google for other languages for finding things.

EDIT: Oh, you can also click to go to the operator docs. For the case of <$>, the docs would tell you that it's an fmap synonym.