In the suggestions for Haskell-2 i wrote >> class (Ring r,AddGroup (m r)) => RightModule m r where >> cMul :: m r -> r -> m r >> instance Ring r => RightModule r r where cMul = mul >> ... >> Haskell rejects this `=> RightModule r r' >> How can we express the meaning ... RightModule m r where m is the identical constructor (m a = a) >> Scripting newtype Id a = Id a deriving(...) >> instance Ring r => RightModule Id r where >> cMul (Id r) r' = Id (mul r r') >> is an awkward way-out. Simon L Peyton Jones <[EMAIL PROTECTED]> replies > So here, m :: *->* > What you really want is to say > > instance Ring r => RightModule (\t->t) r where cMul = mul > > so that now you can use cMul at type cMul :: Foo -> Foo -> Foo > (provided Foo is an instance of Ring). > > The '(\t->t)::*->*' is your 'transparent newtype' function. Exactly. Thank you for explanation. > ... > What I don't know how to do is to perform type inference on such > systems. > ... "It's complicated". OK. Then, with the Haskell-2 instrument, we will, probably, script newtype Id a = Id a deriving(...) instance Ring r => RightModule Id r where cMul (Id r) r' = Id (mul r r') and tolerate the conversion between r and Id r. And the application consideres Id as a parasitic constructor forced by the language restriction. So, to reduce this infelicity, we need here newtype Id a = Id a deriving( all ) - as i proposed in the recent letters. S.P.Jones: > That would indeed be possible for newtype; but my guess is > that if you want 'all' then you ought to be able to get away without > a newtype at all. But I might well be wrong about this. > Anyway, it's not an unreasonable suggestion. `all' is necessary here. Because the program deals with the values of type Ring r => r, and after introducing of Id, it has also to deal with Ring r => Id r and Ring (Id r) => Id r (+,*,cMul applied to r as well as to Id r things), and Ring is preceeded by certain superclass hierarhy ... At least, it is needed here ...deriving( (upTo Ring) ) Am i missing something? ------------------ Sergey Mechveliani [EMAIL PROTECTED]