[Haskell-cafe] No instance for (Eq v) trouble

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Mar 22 12:02:41 UTC 2014


On Sat, Mar 22, 2014 at 12:50:14PM +0100, martin wrote:
> instance Show (WeekdayPattern v) where
>         show wdp = show $ groupBy sameValue expanded
>                 where
>                     expanded  = zip (map (at wdp)  [0..6]) [0..6]
>                     sameValue x y = (fst x) == (fst y)
[...]
> I tried inserting an (Eq v) => in various places of the class or data
> declaration, but the compiler either didn't like
> that or it did not solve the problem. There is no problem just writing a
> show-like method as in

What's wrong with

    instance (Show v, Eq v) => Show (WeekdayPattern v) where
        ....

Tom

PS It helps answerers if you can post the smallest *complete* code that
demonstrates the problem, without commentary interspersed.


More information about the Haskell-Cafe mailing list