[Haskell-cafe] Class and Instance

Daniel Schoepe daniel.schoepe at googlemail.com
Fri Jun 10 19:04:59 CEST 2011


On Fri, 10 Jun 2011 17:28:22 +0100, Patrick Browne <patrick.browne at dit.ie> wrote:
> -- Not OK
> -- insert 2 [9,2]

This causes an error, because numeric literals like 2 are polymorphic:

> :t 2
2 :: Num a => a

If you fix the type to Integer, it works as expected:

insert (2 :: Integer) [9,2]

By the way: It's helpful to include the error messages in your mail when
some piece of code doesn't compile.

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110610/6c8f1a21/attachment.pgp>


More information about the Haskell-Cafe mailing list