[Haskell-cafe] A yet another question about subtyping and heterogeneous collections
roma at ro-che.info
Thu Oct 18 19:42:05 CEST 2012
* Dmitry Vyal <akamaus at gmail.com> [2012-10-18 17:31:13+0400]
> On 10/18/2012 03:20 PM, MigMit wrote:
> >Why do you need "ALike x", "BLike x" etc.? Why not just "Like u x"?
> Hmm, looks like a nice idea. I tried it, unfortunately I can't cope
> with compiler error messages:
> Context reduction stack overflow; size = 201
> Use -fcontext-stack=N to increase stack size to N
> Upcast a b
> In the first argument of `(.)', namely `(upcast :: b -> a)'
> In the expression: (upcast :: b -> a) . (upcast :: c -> b)
> In the expression: (upcast :: b -> a) . (upcast :: c -> b) $ x
> instance (Upcast a b, Upcast b c) => Upcast a c where
> upcast = (upcast :: b -> a) . (upcast :: c -> b)
This is the offending instance. Remember, GHC only looks at the instance
head ("Upcast a c" here) when it decides which instance to use.
More information about the Haskell-Cafe