[Haskell-cafe] Fixing undeduceable instance ==> overlapping instance

Michael Orlitzky michael at orlitzky.com
Sun Feb 24 08:47:54 CET 2013


On 02/24/2013 02:14 AM, Karl Voelker wrote:
> On Sat, Feb 23, 2013 at 10:28 PM, Michael Orlitzky <michael at orlitzky.com
> <mailto:michael at orlitzky.com>> wrote:
> 
>       -- Recursive case, (n+2) x (n+2) matrices.
>       instance (Eq a, Ring.C a, Arity n)
>              => Determined (Mat (S (S n)) (S (S n))) a where
>       determinant m =
>         ...
>         -- Recursive algorithm, the i,jth minor has dimension
>         -- (n+1) x (n+1).
>         foo bar (determinant (minor m i j))
> 
>     I get an error stating that I'm missing an instance:
> 
>       Could not deduce (Determined (Mat (S n) (S n)) a)
>       ...
> 
> 
> It looks to me like you just need to add (Determined (Mat (S n) (S n))
> a) into the context of this instance. The problem is that the type
> variable "n" could be almost anything (at least as far as this instance
> definition knows).
> 

So simple, thank you!




More information about the Haskell-Cafe mailing list