Rewrite error handling in the compiler with a new Result monad.
Add support for filter in the compiler.