To my request on Haskell-2
>> Obstacle 2: 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.
>> Because from this point on, the programmer has to convert the data
>> explicitly between r and Id r ...
Mariano Suarez Alvarez <[EMAIL PROTECTED]> replies on 27 Jul 1998
>Actually and strictly speaking, the `awkward' way out is here the correct
>one, because it makes explicit the difference between the ring and the
>canonical module over itself it determines.
>The instance Ring r => RightMod Id r can be regarded as an expression of
>the fact that Id : Rng -> Mod is a functor, (which can't be an identity
>functor, because domain and codomain aren't the same!)
Still i think instance Ring r => RightModule r r where cMul = mul
does expess what it is needed.
Here it is *not written* that r (only) is a RightModule.
It is written that r and r are related via the operation
cMul = mul :: r -> r -> r,
which makes (r,r,mul) to represent a RightModule.
So it makes the difference between r and (r,r,cMul) clear enough.
And on the other hand, one would prefer to write
cMul 2 3 rather than cMul (Id 2) 3
Here the question is whether Haskell-2 can introduce the
*transparent projection constructor*.
Suppose, for class C m a b c where c :: m a b c -> c
one needs to express instance (A s,A t,A u)=> C t s t u where...
which is written more correctly as
instance (A s,A t,A u)=> C P2 s t u where...
newtype P2 a b c = b
Still it is not correct Haskell.
Haskell would require `= P2 b' rather than `= b', and this brings
unnecessary constructor P2 in the algebraic expressions.
Can Haskell provide things like newtype' P2 a b c = b
- only to be the values of a type constructor variable in an instance
declaration?
But i do not know, it may occure some principal inconsistency in this
suggestion.
------------------
Sergey Mechveliani
[EMAIL PROTECTED]