[Haskell-cafe] Overlapping instances with "instance F a => G a"
bog at khumba.net
Thu Jan 22 23:34:35 UTC 2015
On Thu, 1 Jan 2015 17:15:31 -0500
Brandon Allbery <allbery.b at gmail.com> wrote:
> On Thu, Jan 1, 2015 at 4:29 PM, Bryan Gardiner <bog at khumba.net> wrote:
> > Doesn't "HostBinaryNum a => HostBinary a" create a HostBinary instance
> > for all instances of HostBinaryNum only? So why would it cause
> No, it creates an instance for all types, then checks for HostBinaryNum at
> the point where it tries to use the instance.
Brandon, Tom, thanks for the reponses. I can only claim rudimentary
typeclass knowledge but I find it odd for the instance statement to
create instances for all types if it's going to only be usable for
types with HostBinaryNum instances. From my reading of the GHC
manual, it's generally only an error when a conflict actually occurs,
not if a conflict might occur. Is there a benefit to having it this
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 801 bytes
Desc: not available
More information about the Haskell-Cafe