[Haskell-cafe] How to define Show [MyType] ?
Jonathan Cast
jonathanccast at fastmail.fm
Thu Dec 4 17:49:40 EST 2008
On Thu, 2008-12-04 at 14:46 -0800, Ryan Ingram wrote:
> > If you really, really wanted to define Show [ShipInfo], then putting
> >
> > {-# LANGUAGE FlexibleInstances, OverlappingInstances #-}
> >
> > at the beginning of your file would work. At the cost of using
> > overlapping instances, of course.
>
> And at the cost of causing code like this:
>
> > f :: Show a => [a] -> String
> > f xs = show xs
>
> to fail to compile (see "Incoherent Instances").
Right.
> Implement "showList"; it's the Right Answer for this case.
Yeah.
jcc
More information about the Haskell-Cafe
mailing list