Handling IOErrors in haskell