[Haskell-cafe] Instance match surprise
Wojtek Narczyński
wojtek at power.com.pl
Mon Feb 1 22:33:46 UTC 2016
On 01.02.2016 21:34, Ben wrote:
> But there *could* be other instances the compiler just can't see at
> the moment (because it's in another module that's not imported).
> Someone else could then import this module and that other module and
> observe inconsistent instances.
>
Okay, I get it. In another module there might be instances Eq and
Typeable for ANY, and then the instances would indeed overlap. It makes
sense.
> To avoid that problem, the type class system *never* commits to
> "negative" information; if an instance choice is only valid because
> there *isn't* a possible instance in scope then that instance choice
> is not valid after all.
>
I will have to produce many instances by hand.
Couldn't the compiler just postpone the its overlap checking until
linking? Or might I forbid creation of Eq and Typeable instances of ANY?
--
Wojtek
More information about the Haskell-Cafe
mailing list