[Haskell-cafe] Dealing with incoherent instances
coffeemug at gmail.com
Wed Dec 27 09:29:37 EST 2006
I'm looking at GHC's overlapping instances docs here:
and I've ran into the incoherent instances problem.
Basically, I have a "catch all" instance that handles all types in a
generic manner using SYB introspection, and then I have type specific
instances that specialize behavior for certain types. This works with
overlapping instances extension but whenever I take advantage of this
functionality from polymorphic functions I run into the incoherent
If I enable incoherent instances GHC always picks the general case
which seems like the wrong thing to do. What I want it to do is delay
comitting to an instance until it's processing a specific invocation
of a polymorphic function. All the information is available at compile
time but I found no way to do this.
Is there a way to get around this problem?
More information about the Haskell-Cafe