Overlapping instances — not clear which instance is chosen by Haskell?

The instance for Problem used is made for be -> c If you look at the signature of showProblem you will see that there is no ShowType context. If there is no context, the compiler can only infer the instance statically. Because of this, the instance for be -> c is chosen, as it is the instance that fits statically.

The instance for Problem used is made for be -> c. If you look at the signature of showProblem, you will see that there is no ShowType context. If there is no context, the compiler can only infer the instance statically.

Because of this, the instance for be -> c is chosen, as it is the instance that fits statically. I don't know how to solve this, IMHO it could work to provide the context by hand, but I really don't know: class Problem a where showProblem :: ShowType a => a -> TypeString instance Problem (b -> c) where showProblem :: ShoType (b -> c) => (b -> c) -> TypeString showProblem = theType For me, using OverlappingInstances usually means, that I did a wrong design decision in my code.

I read the Haskell wiki about OverlappingInstances. It say it's useful on occasion, but I can imagine an example. – Zhen Jul 6 at 10:35 @FUZxxk: ... you mention, that using overlaps means wrong decision decisions; but doesn't the whole Data.

Typeable module and the whole Scrap Your Boilerplate-Stuff bases on overlapping instances? – phynfo Jul 6 at 13:31.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions