Make compile() return a Result

closes #4