problem with existential types

Zoltan Varga zvarga@gw.cdk.bme.hu
Tue, 04 Apr 2000 13:49:12 +0300


I tried to run the following little program under Clean 1.3.2 on
windows:

module crash

:: Object = E.x:  {  state  :: x
     , set  :: x Int -> (x, Int)
     }

CreateObject1 :: Object
CreateObject1 = {state = [], set = myset}
where
 myset :: [Int] Int -> ([Int], Int)
 myset is i = ([i:is], i)

Set :: Object Int -> Object
Set o=:{state,set} i = {o & state = set state i}

Start
 # o = CreateObject1
 = Set (Set o 5) 11

As far as I can tell, this code contains a type error, because it
changes the type
of the 'state' field to (Int, Int) without changing the type of the
'set' field.
However, the compiler accepts this code, and the program crashes at
run-time.

Another problem I'm experiencing is that the linux version of the clean
compiler(clm)
allways returns with exit code 0, even if there were errors during
compilation.
This makes it hard to use the compiler in Makefiles etc.

           bye

             Zoltan