4 ms·
There's a bit of writing on StackOverflow about it: http://stackoverflow.com/questions/2982012/haskells-typeclasses-and-gos-interfaces http://stackoverflow.com
by bkirwi 12y ago
There's a bit of writing on StackOverflow about it:
http://stackoverflow.com/questions/2982012/haskells-typeclasses-and-gos-interfaces http://stackoverflow.com/questions/2982012/haskells-typeclas...
The main similarity is that 'methods' are defined 'outside' the data type they belong to. But there are a huge number of differences: Haskell's typeclasses are used for many things that don't look like methods at all, while Go's behave more like a classic OOP interface you'd find in Java.
So, perhaps superficially similar-looking, but they work quite differently in practice.