Uses State Monad

Formalized some of the helper functions by using the State Monad.
Cleaned up Emit.hs.  emitModule now returns an IO String; changes
have been made to Main.hs to accomodate this.