[Haskell-beginners] deducing type of multi-parameter type class

Michael Snoyman michael at snoyman.com
Thu Jul 15 03:35:14 EDT 2010


On Thu, Jul 15, 2010 at 10:09 AM, Felipe Lessa <felipe.lessa at gmail.com>wrote:

> On Thu, Jul 15, 2010 at 3:13 AM, Michael Snoyman <michael at snoyman.com>
> wrote:
> > You could also use type families for this, but I believe you cannot
> express
> > the "Show" superclass:
> > class MyClass a where
> >     type MyResult a
> >     fn :: a -> MyResult a
>
> I guess this works:
>
> class Show (MyResult a) => MyClass a where
>   type MyResult a
>  fn :: a -> MyResult a
>

Thanks, I forgot about that. Funny, because I use it in Yesod ;).

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100715/7ba73e2e/attachment.html


More information about the Beginners mailing list