Save point before I start porting analyse to the monad version
The type checker works for basic tests