Mon Jan 28 21:46:07 CET 2013

Occurs check

Something is working, but the types are all messed up.
- const doesn't work properly
- what's the type of i?  It should be (B t)

I think I see what's going on: the accumulation operation will unify
the accumulator itself with (B t).

This means I'm missing an occurs check.  Probably what happens is that
t and (B t) are unified.

Yes.  Added the occurs check.  Should make it more verbose though,
with syntax info and stuff..  

Found the problem: the weird type lifting stuff in loops makes that
the accumulator has the lifted type.  It needs to be cast to the lower
type.  This can be done by inserting an assignment and manually
unifying the 2 node types.