3 ms·
I'm also not sure what these type extensions have to do with monads, monads just describe side effects as a type. Read about the async keyword in C# if you wan
by fleitz 15y ago
I'm also not sure what these type extensions have to do with monads, monads just describe side effects as a type.
Read about the async keyword in C# if you want to know why monads are useful. I'm not sure why MSFT decided to take a great thing like monads and only allow one type of monad instead of building in support for the general case, it seems so typical in imperative languages that the forest is missed for the trees. They'll take a great thing like generics and then screw it up by only allowing methods on classes which ruins type inference.
for example:
var a = new Array<int>(1,2,3,4);
instead of
var a = Array.new(1,2,3,4);
I'm not sure why ordinary programmers shouldn't know what a monad is, it's an extremely useful pattern that makes code much easier to read. It's like not knowing what an array is.
- noblethrasher 15y ago>I'm not sure why ordinary programmers shouldn't know what a monad is, it's an extremely useful pattern that makes code much easier to read. It's like not knowing what an array is. I'd say it's like only knowing what an array is instead of being able to generalize to an Enumerable/Iterable thing.
- skybrian 15y agoI'd say it's more like struggling to understand pointers: there's plenty of evidence that beginners struggle with it (e.g. all the monad tutorials), and if you're surprised by that then I'd guess you haven't done much teaching or interviewing. (One of my favorite interview questions requires people to understand escape sequences in a slightly more abstract way than usual, and you'd be surprised.) In general I find that people do better with concrete examples and struggle with abstract rules. It's not at all obvious to a JavaScript programmer (for example) that asynchronous calls have anything to do with monads, and the designers of mainstream languages have to be very aware of their audience. So, my question is how extending the type system might be turned into a concrete feature in a "mainstream" language. It's not too often that we need to prove things about red-black trees.