Hacker News new | past | comments | ask | show | jobs | submit login

>which could be implemented in almost any language.

You need HKTs to have type-checked generic monads. Almost no languages have them.




Yes, if you want type-checked generic monads.

Dynamic languages can implement generic, but not type-checked monads. Many static languages can implement type-checked but non-generic monads.

Now you need to show how type-checked generic monads are critical. That's much harder than showing that the monadic pattern is useful.


Except in dynamic languages most people reinvent the wheel and don't quite get to a monadic interface. Like Javascript promises. They could have had ONE interface that is consistent. But Promises are actually a special snowflake that solves the problem in a slightly different way with a slightly different interface. And that's because nobody can complain that their stuff doesn't compile due to it not satisfying some interface.


Being able to abstract over the monad leads to monad transformers of the `transformers`, `mtl`, and `extensible-effects` varieties. You can argue that those aren't valuable, but I don't think you can argue that type-checked generic monads are critical for achieving them.

In practice, 75% of the time that I use monads I am using some kind of monad stack. I'm sure you can argue that this is unnecessary or that I only do so because Haskell affords it... but on the other hand, I believe that transformer stacks do a good job of elaborating the space of effect types with an efficient, expressive language. Without them you either elide side effect reification or build a lot of one-off monad stacks.




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

Search: