# default class method types... (unification)

MR K P SCHUPKE k.schupke@ic.ac.uk
Fri, 06 Sep 2002 16:46:47 +0100

  ah - of course...

so if I have an instance

instance A m m where

f = id

all works well!

I still have a problem though - perhaps it is also possible to avoid...

I am trying to define a parametric continuation monad transformer
(from a paper by Ralf Hinze...) however the functions as given have
type errors... in particular the following (which is similar to the simple
case I just gave)

up ::tm ta -> t tm ta
down :: t tm a -> tm ta

we define the type for our parametric continuation:

data ContT ans m a = CT ((a -> m ans) -> m ans)

up m = CT \$ \kappa -> m >>= kappa
down (CT m) = m return

however this gives a unification error (less polymorphic than expected)
for the definition of down (that a' is unified with ans')??

Regards,
Keean Schupke.

Martin Norbäck wrote:

>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.
>