default class method types... (unification)

Martin Norbäck d95mback@dtek.chalmers.se
06 Sep 2002 15:26:22 +0200


--=-stO1YNQ8GcPqxWb3cd45
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

fre 2002-09-06 klockan 15.01 skrev MR K P SCHUPKE:
> If I have a class:
>=20
> class A m n where
>     f :: m a -> n a
>=20
> I can declare instances
>=20
> instance A Maybe Maybe where
>     f =3D id
>=20
> instance A [] [] where
>     f =3D id
>=20
> but if I try and put a default method:
>     f =3D id
>=20
> I get a unification error (less polymorphic than expected).This seems
> a little odd - is there a work around for this?

Because that default method only works when m=3Dn, which it's not in the
general case.

--=20
Martin Norb=E4ck          d95mback@dtek.chalmers.se             =20
Kapplandsgatan 40       +46 (0)708 26 33 60                   =20
S-414 78  G=D6TEBORG      http://www.dtek.chalmers.se/~d95mback/
SWEDEN                  OpenPGP ID: 3FA8580B

--=-stO1YNQ8GcPqxWb3cd45
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: För information se http://www.gnupg.org/

iD8DBQA9eKz+kXyAGj+oWAsRAnH9AJ0TbfR240f9ajO7taq26pTHeVrcbQCfZpKk
Xl2o1K9JcFW5cyv0GdDFSfM=
=fyrj
-----END PGP SIGNATURE-----

--=-stO1YNQ8GcPqxWb3cd45--