[clean-list] uniqueness question

Carlos Aya carlosayam at yahoo.com.au
Mon Nov 16 04:04:00 MET 2009


Hi,

Does anyone know why the following type signature is invalid?

second :: *a .a -> *a
second x y = x

I am getting this message
Error [matrices.icl,12,second]: a inconsistently attributed (4)

I came across this trying to type a more complex function with arrays, but it boils down to signature above.

Why the uniqueness attribute has to be the same for two independent parameters that just happen to have the same type?

A workaround I found was to use two different type variables, like
second :: *a .b -> *a
which will work properly on usage site by unification, but still I was wondering what the problem was with the first one.

regards
Carlos


      __________________________________________________________________________________
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/



More information about the clean-list mailing list