
At Fri, 28 Sep 2012 18:33:23 -0700, Alexander Solla wrote:
Only with respect to type inference.
I don't understand this comment.
I wouldn't have replied with that line of thought if you had just told us what the problem was in the first place. I /was/ saying that you can use explicit type annotations to disambiguate instances.
Most of us haven't memorized the Haskell 2010 report. We let the compiler tell us what's wrong and either learn why, or how to fix it. So post your errors.
Sorry, I posted in a hurry. Besides, feeding those lines to a compiler before replying takes 10 seconds.
By the way, it is rather rude to publicly post a private email...
I thought that you had forgot to reply all, as often happens. I also want the discussion to stay on the list, so that people can read in the future. I'm sorry if that email was meant to be private, I saw nothing private about it.
Now, on to your real problem.
Use TypeFamilies instead:
class Foo a where type BarThing a :: *
class Foo a => Bar a where foo :: a -> BarThing a -> b
As I mentioned in the original post, `Foo' is outside my control.
This is pretty pointless, since you can just refactor into the nearly equivalent:
class Foo a
class Foo a => Bar a where type BarThing a :: * foo :: a -> BarThing a -> c
It may or may not matter to which family the type synonym belongs.
Mine was a contrived example to show the issue. The whole point is to reduce the number of arguments of a class by referring to another class and its fundeps.
What is the problem you are actually trying to solve?
What I actually (would like to) have is something like this:
class (EditDistance algo sym, ListLike full sym) =>
Search container full algo | container -> full, container -> algo where