Add a cabal build script.

Moved Main.hs to src/main to stop ghc from recompiling library files when
building the other targets.
Make the type checker return a tree with type annotations.

This is a follow-up of 45ee6cdbf034c1b17716202dda65e1c393985af7. For type
inference, return an expression with typed annotated.