When to use 'ioError. userError 'instead of' error '

When reading the source code of the package network, I noticed that it is widely used ioError (userError ("Error description"))to raise errors during I / O operations.

Since this is not the first time I have seen this, I was wondering what the difference is in the practice of using this template instead of from . errorPrelude

I know what ioError . userErrorcalls in the monad , but calls a anywhere, but in the end both are destined to interrupt the program, showing a simple error message. IOExceptionIOerror ErrorCall

In which scenarios ioError . userErrorwould it be beneficial to use error?

+4
source share
1

error . , -, , . error ErrorCall, , , , , , error. , .

IOException, , C/Java. userError , , AlreadyExists ResourceBusy, .


, .

Haskell, loch-th , error, , "todo" , , .

, , Haskell. , , , , . IO (), . , , , , โ€‹โ€‹ . , , , EitherT monad transformer util-library ErrorT. , . ErrorT EitherT + "".

+8

Source: https://habr.com/ru/post/1531531/


All Articles