IR*: removed fromJust, use guardJust instead.
AST->IR: added types in more places
IR: simplified some bits