Local types and instances

Matthew Farkas-Dyck strake888 at gmail.com
Sun Apr 29 23:37:13 UTC 2018


On 4/29/18, Edward Kmett <ekmett at gmail.com> wrote:
> This isn't sound.
>
> You lose the global uniqueness of instance resolution, which is a key part
> of how libraries like Data.Set and Data.Map move the constraints from being
> carried around in the Set to the actual use sites. With "local" instances it
> is very easy to construct such a map in one local context and use it in
> another with a different instance.

Ah, i forgot to say explicitly: local instances of types declared at
greater scope are not allowed. Is it unsound nonetheless?


More information about the Haskell-prime mailing list