4 ms·
The majority of internet conversations about monads never get past the most shallow introduction. The most important feature of monads is that they can be compo
by danharaj 9y ago
The majority of internet conversations about monads never get past the most shallow introduction. The most important feature of monads is that they can be composed via monad transformers. A la carte languages and algebraic effects are nice, but monad composition is more powerful.
Also, as someone in the Haskell industry, I think you're wrong about trends. The last 5 or so years have been an accelerating trend of Haskell adoption. Of course it is still dwarfed by most other languages, but the number of multi-million dollar contracts I've seen executed in Haskell has been multiplying.
- bojo 9y agoAs a relatively tiny data point, I've introduced Haskell at a small telecom doing $350M/yr in revenue. This kind of environment screams "Enterprise", but as it turns out the vast majority of problems that need solved can be done quite gracefully with Haskell.
- alphaalpha101 9y agoYeah at the end of the day it's just another programming language, and you can really get things done in any programming language.
- lmm 9y agoIt's an incremental improvement on what's gone before, sure, but it does offer a bunch of genuinely useful facilities that a lot of programming languages just don't have. I'd never want to go back to a language that was missing HKT, missing libraries of generic operations on monads, missing libraries of generic operations on recursive datastructures via fixed points, or missing safe derivation of operations on structured data via typeclass derivation or similar.
- goldenkey 9y agoYou want Mathematica then..
- alphaalpha101 9y agoI never ever want to use a language with those features again. HKT are completely unnecessary. No code ever wants or needs HKT. They're pure wankery. Libraries of generic operations on recursive data structures via fixed points? Come on. This is why Go doesn't have generics. They don't want this crap infecting their language. Typeclass derivation? Typeclasses are a terribly designed language feature that is inferior to ML modules in every way.
- dang 9y agoCould you please keep programming language flamewars off HN? We're trying to avoid the destruction that befalls places that host these.
- alphaalpha101 9y agoThe most important feature of monads definitely isn't composition, because they don't compose well at all. Monad composition is the worst feature, by far, because it doesn't exist. >Also, as someone in the Haskell industry, I think you're wrong about trends. The last 5 or so years have been an accelerating trend of Haskell adoption. Of course it is still dwarfed by most other languages, but the number of multi-million dollar contracts I've seen executed in Haskell has been multiplying. That's my point: that's the hype cycle, and it's now peaking as people realise what a lot of effort it is to actually use monads in reality with the awful complexity of monad transformer stacks and such.
- kreetx 9y agoCan you clarify what do you mean by they don't compose at all? It feels like you've had some tough experiences with monads (monad transformers), and I agree, they are hard to get into.
- lambdas 9y agoSometimes two monads composed don't form another monad. Unlike Functors and Applicatives. Simple example, if you have a list containing functions ([Reader r a]) it forms an Applicative fine as they compose. However you can't satisfy the conditions needed to form a Monad.
- danharaj 9y agoYou can compose monads whenever you have a distributive law for them. Usually there's an obvious one. In your example there's a distributive law that uses the same parameter for every function, this allows you to compose the monads. When there's several possible distributive laws or none, that's important. It means that either the interactions between the two effects are subtle and need to be further specified or they are completely incompatible. Algebraic effects can only handle effects that trivially commute. So monad composition is a finer, thus more expressive operation.
- 9y ago