Re:Scala founder: Language due for 'fundamental rethink'
by skybrian on Saturday September 06, 2014 @12:27PM
(#8278703)
I don't understand your example. Is there an explanation for people who aren't Haskell experts somewhere?
Re:Scala founder: Language due for 'fundamental rethink'
by frowaway001 on Saturday September 06, 2014 @02:18PM
(#8279024)
> For instance, in Haskell you can prove a functor instance has at most one implementation
How would one do that?
For instance, in Haskell you can prove a functor instance has at most one implementation (if we disallow diverging values), uniquely given by fmap id === id. GHC can automatically derive it for you. If you have dynamic polymorphism this is lost because now you can have "nonuniform" functor instances that behave differently for different types while still satisfying the functor laws.
More generally, parameteric polymorphism eliminates a large number of "behavior surprises" that can lurk in OO code. And with existential types I never find myself missing dynamic polymorphism. Similarly, in Clojure, if I find myself using dynamic behavior, it's either to interact with Java or as a hacky version of parameteric behavior.