[clean-list] Synonym type and Universal type
lethevert
acatofearlgrey at ybb.ne.jp
Sun May 6 17:51:16 MEST 2007
Hello,
I have a question about synonym type and universal type.
Section 5.3 in Clean Language Report version 2.1 says
============================
SynonymTypeDef = ::TypeLhs :== [UniversalQuantVariables]Type ;
============================
However I found some problem on using synonym type and universal type together.
The following program
============================
Start = f id 1 "a"
id a = a
::Id :== A.a: a -> a
f :: Id Int String -> (Int, String)
f g i s = (g i, g s)
============================
produces type unification errors.
============================
Compiling Main
Type error [Main.icl,11,f]: near g : cannot unify types:
v5 -> String
Id
Type error [Main.icl,5,Start]:"argument 1 of f" cannot unify types:
Id
v1 -> v1
============================
But if we modify the first program as the following way
============================
::Id a :== a -> a
f :: (A.a: Id a) Int String -> (Int, String)
f g i s = (g i, g s)
============================
it doesn't produce any errors.
Why this happens?
--
lethevert
lethevert at users.sourceforge.net
More information about the clean-list
mailing list