3 ms·
I don't think you can be surprised that Python or Javascript are more popular than Haskell. Just the monad thing rules it out entirely. I would say ML might ha
by IshKebab 2y ago
I don't think you can be surprised that Python or Javascript are more popular than Haskell. Just the monad thing rules it out entirely.
I would say ML might have been a more popular language, but again it's just a bit too weird for people that aren't deeply into academics / PL research. Also the tooling is just bad, even to this day. (Tbf that is true of Python too.)
- cess11 2y agoMonads aren't weird. Basically it's data structures you can map over and flatten, like a list or a maybe/result/option. Everyone who isn't extremely junior knows about them. There's some theory that ties into formal systems and blah blah blah, but you sure don't need to be janking your monoid in public to understand and use monads. As for tooling, few people actually want immersive, robust tooling. If that was popular things like Pharo and Allegro wouldn't be niche. Most want crude text editing with pretty colours and not much more.
- nuancebydefault 2y ago'Weirdness' is, as this conversation confirms, in the eye if the beholder. I _find_ ruby weird and non-intuitive.
- cess11 2y agoIt's a claim that monads are somehow supernatural, twists of reality, which is obviously not the case since a lot of people who have never learnt the word monad are using them daily in the form of Optional style types and lists and so on.
- gklitz 2y ago> Monads aren't weird. Basically it's … Says everyone after having spent months getting the hang of it and more months writing blogs about how everyone is wrong to think it’s difficult because when you think about it “ A Monad is just a Monoid in the Category of Endofunctors” It’s incredible just how blind most programmers are to the time they spend on learning things to come to the point where they think a subject is simple and how they all assume that any junior should just listen to their magical recital of a boiled down explanation and immediately understand it at a fundamental level.
- norir 2y agoThe weird thing is the word monad and the technical formalism. Practically speaking, I really don't see why I decent junior can't understand x = [1, 2, 3].flatMap(el => if (el % 2 == 0) [] else [ el ]) // x = [1, 3] vs x = [] for (i = 1, i <= 3, i++) { if (i % 2) == 0) x.push(i) } // x = [1, 3] or some such. There are advantages and disadvantages to either style of programming. I actually don't like pure functional or imperative style because of the respective tradeoffs each make (functional style requires either significant runtime overhead or heavyweight compiler optimizations and imperative gets messy very quickly and is typically difficult to reason about as program size expands).
- jerf 2y agoThe problem is, that's not "monad"; that's the implementation of the monad interface specifically on an array. That's like claiming to understand "iterators" because you understand how to write an iterator implementation on an array, but then trying to take that understanding to an iterator that yields the primes in order. If you think "iterator == presenting each element of an array in order", and nothing else, you don't actually understand iterators, because presenting each element of an array in order is an iterator, not the concept of iterators. "flatMap" is a monad, it is not the concept of monad.
- shawn_w 2y agoI think any language that has a flatmap type construct would also have filter functions that would be a lot clearer to read and write... (remove-if #'evenp '(1 2 3)) vs (mapcan (lambda (n) (if (evenp n) '() (list n))) '(1 2 3)) in Common Lisp for example. (Yes I know the original is just a contrived example that you shouldn't read too much into, but...)
- squillion 2y agoIf they were called "flatmappable" (which is essentially what they are), people wouldn't complain so much about monads. But in Haskell you have to bend over backwards just to set a variable you think should be in scope, or to log something to the console, and monads are involved in achieving that kind of things. Haskell is hard - monads in themselves not really.