Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think it is at least somewhat wrong to say that monads are just an interface. For instance, when the author says (paraphrased) “you could remove every trace of monads from IO and it would still be usable, albeit clunky”, they’re actually talking about removing the monad interface, but not the monad structure — it would still rely on a function of type (IO a -> (a -> IO b) -> IO b) that’s expected to follow certain rules. In my book, that is a monad — whether or not it’s called “monad”, and whether or not it’s formalized as such.

(This isn’t an entirely new kind of concept in programming, either; see “patterns”.)



i am interpreting this as "monads are a structural type, not a nominal type".

which to me is an interesting debate given Haskell's emphasis on strong interfaces strictly enforced.

We seem to be converging on a world where we agree that declaring and enforcing types is very important, yet also that it's the structure of the type, not its name, that is most critical. At some point, with sufficiently advanced type inference, do you end up in a world that looks like a lot like fully dynamic languages, where the actual declaration of the type is purely optional?




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

Search: