default class method types... (unification)

If I have a class: class A m n where f :: m a -> n a I can declare instances instance A Maybe Maybe where f = id instance A [] [] where f = id but if I try and put a default method: f = id I get a unification error (less polymorphic than expected).This seems a little odd - is there a work around for this? Regards, Keean Schupke, Department of Electrical & Electronic Engineering, Imperial College London.

fre 2002-09-06 klockan 15.01 skrev MR K P SCHUPKE:
If I have a class:
class A m n where f :: m a -> n a
I can declare instances
instance A Maybe Maybe where f = id
instance A [] [] where f = id
but if I try and put a default method: f = id
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=n, which it's not in the general case. -- Martin Norbäck d95mback@dtek.chalmers.se Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B
participants (2)
-
Martin Norbäck
-
MR K P SCHUPKE