If you do runNeo4j (void $ runBatch f) conn, even if the batch fails you never get exceptions. This is extremely surprising and counterintuitive for the user. Generally, you should avoid error and throw in most code, throwing exceptions from pure values is terrible for API users, we do not expect it. In particular, it is unexpected that something that essentially lives in IO would use throw rather than throwIO.
This is a very common pattern, since you rarely care about the Graph that results from a batch operation.
I think the quick fix would be to use $! after the return in the definition of runBatch, but it would be better to use throwIO.
If you do
runNeo4j (void $ runBatch f) conn
, even if the batch fails you never get exceptions. This is extremely surprising and counterintuitive for the user. Generally, you should avoiderror
andthrow
in most code, throwing exceptions from pure values is terrible for API users, we do not expect it. In particular, it is unexpected that something that essentially lives in IO would usethrow
rather thanthrowIO
.This is a very common pattern, since you rarely care about the Graph that results from a batch operation.
I think the quick fix would be to use
$!
after thereturn
in the definition ofrunBatch
, but it would be better to usethrowIO
.