How overload operator in Haskell?
Martin Sjögren
martin@strakt.com
11 Jul 2003 09:10:36 +0200
--=-FCgQaGIzIAaDQMvlvMiN
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
fre 2003-07-11 klockan 08.07 skrev Ashley Yakeley:
> In article <16140.55249.147965.603167@cerise.nosuchdomain.co.uk>,
> Glynn Clements <glynn.clements@virgin.net> wrote:
>=20
> > > instance Num Vector where
> >=20
> > Except that class instances have to be algebraic datatypes ("data") or
> > renamed datatypes ("newtype"), but not type synonyms ("type").
>=20
> That's not true, is it? I mean as long as there isn't already some=20
> overlapping instance, I think it's quite OK.
Well, there's the "The instance type must be of form (T a b c) where T
is not a synonym, and a,b,c are distinct type variables" restriction
(ghc), or as hugs put it: "Cannot use type synonym in instance head"
You get around it with hugs -98 or ghc -fglasgow-exts. Dunno about
nhc98.
/Martin
NB: I just used class Foo ; instance Foo String to produce these error
messages...
--=20
Martin Sj=F6gren
martin@strakt.com
Phone: +46 (0)31 7490880 Cell: +46 (0)739 169191
GPG key: http://www.strakt.com/~martin/gpg.html
--=-FCgQaGIzIAaDQMvlvMiN
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
iD8DBQA/DmLsGpBPiZwE9FYRAqEFAJ0Stkhr5Ale739WiamyPmkFqCW8nACgow8T
r2kw7lgRCDES89SCwdhxRsQ=
=kTId
-----END PGP SIGNATURE-----
--=-FCgQaGIzIAaDQMvlvMiN--