[Haskell-cafe] Overlapping instances with "instance F a => G a"

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Thu Jan 1 21:52:53 UTC 2015


On Thu, Jan 01, 2015 at 01:29:59PM -0800, Bryan Gardiner wrote:
>       Overlapping instances for HostBinary Word8
[..]
> Doesn't "HostBinaryNum a => HostBinary a" create a HostBinary instance
> for all instances of HostBinaryNum only?
[..]
>   instance HostBinary Word8 where
[..]
>   instance HostBinaryNum a => HostBinary a where

AIUI `instance HostBinaryNum a => HostBinary a` means "Every instance of the
form `HostBinary a` arises from an instance for `HostBinaryNum a`", so
provding an additional instance `HostBinary Word8` creates (potential)
overlap.

Tom



More information about the Haskell-Cafe mailing list