In this blog post I attempt to connect monads in haskell with generics in go, avoiding flame wars as I go. If I’ve made mistakes please let me know and I’ll gladly fix them.
I’ve just finished listening to episode 10 of the bikeshed which is largely a discussion about haskell, and well worth a listen to. However the conversation that starts at around 29:40 is what triggered this thought.
Haskell without monads
If you want to do IO in Haskell you need to use monads. But it’s possible to write a number of programs without IO(1).
According to “A history of haskell, being lazy with class” 6 years passed between the first release of haskell, and monadic IO being introduced. Why so long?
The language designers were under no pressure, they had time to think about how IO should be dealt with in the language.
The question of Go Generics
Go doesn’t support generics, and it’s often cited as a big downside or even a failing of the language. However you can still write very useful programs in go without generics(1). But here’s the thing:
The language designers are under no pressure, they have time to think about how generics should be dealt with in the language.
This is important. Just because a language doesn’t do something now, doesn’t mean it never will. If you’ve not taken a look at go previously because you’ve been swayed by the “no generics” argument I recomend taking a look at go again.
(1) An infinite number for maths fans