Specifically here:
|
text <- evaluate (T.pack $ show x) `catchAny` \_ -> |
The advantage being that you no longer have to use newtypes and Show to produce something human-readable, especially since using Show for pretty printing is becoming more and more of an anti-pattern in Haskell.
It also means that you can take advantage of the work already done by library authors to provide human-readable exceptions. For example: https://github.com/nikita-volkov/hasql/blob/c74c5829c4d3af685c10717b46c73108a9155871/library/Hasql/Errors.hs#L23-L89