[clean-list] Synonym types

Arjen van Weelden arjenw@cs.kun.nl
Thu, 02 Oct 2003 12:06:11 +0200


Hello,

Alan Hutchinson wrote:
 > [snip]
> The Clean compiler does not pass my code.  The problem seems
> to lie in structures like the types in the following:
> 
>     import StdEnv
>     
>     Start  =  testFn
>     
>     :: SynTypeA a b :== (a,b)
>     :: Constr t1 t2 a b  =  C (t1 a b) (t2 a b)
>     :: SynTypeB a b :== Constr SynTypeA SynTypeA a b
>     
>     testFn :: SynTypeA Int String
>     testFn
>     =  (3,"It works.")
> 
> [snip]
> Seeming reason:
> The parameters t1 and t2 in the definition of Constr
> have to be names of algebraic types, not synonym names.
> [snip]
> Have I got this right?
> is there a way round it?
The Clean compiler does not support the use of synonym types with too 
many, or not enough, type arguments.
It looks like this can be solved by changing the definition of SynTypeA 
to:  :: SynTypeA :== (,)

Unfortunately, the compiler does not support synonym types with kind 
other than *. You can define, but can never use, a synonym type for a 
'real' type with not enough arguments (as I proposed for SynTypeA).

You could replace SynTypeA with (,) everywhere in your code, but that is 
probably not what you want.

regards,
	Arjen