[Haskell-cafe] Deduce problem.

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Thu Nov 17 04:56:01 CET 2011


On Thu, Nov 17, 2011 at 11:48 AM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> Hi,
>  Consider I have declarations like this:
> class (ClassA a) => ClassC a where
>  from :: (ClassB b) => a -> [b]
>  to :: (ClassB c) => a -> [c]
>
> data H = ...
>
> instance ClassB H where
>  ...
>
> data Test = Test { m :: H }
> instance ClassA Test where
>  ...
> instance ClassC Test where
>  from = m
>  to = m
>
>  Well, I got "could not deduce" error here at "from = m" and "to =
> m". `c' is a rigid type variable bound by the type signature for to ::
> ClassB c => Test -> [c].
>  Referring to some similar questions on internet, I should remove the
> (ClassB c) thing. Is this the only solution?
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>

I was wrong, forall b. did not help....

-- 
竹密岂妨流水过
山高哪阻野云飞



More information about the Haskell-Cafe mailing list