top | item 11234862

(no title)

Refefer | 10 years ago

Implicit is basically just an implementation detail. The idea of only allowing one typeclass instance per data is generally referred as confluence and you're correct in that scala doesn't attempt to enforce it.

I understand the Haskell communities desire for coherent typeclasses, but I still find the newtype work around cludge to allow multiple implementation of, say, Monoid to be quasi hacky. What's worse, you can still fairly easily define multiple instances of the same typeclass accidentally (orphan instances) and the compiler won't catch it.

discuss

order

tamana|10 years ago

Compilation is too local, but why can't a postprocess of the linker check for orphan or incoherent instances?