imported monad.error and created error datatype