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
Specifically here:
yesod/yesod-core/src/Yesod/Core/Internal/Run.hs
Line 70 in c9f7ee0
The advantage being that you no longer have to use newtypes and
Showto produce something human-readable, especially since usingShowfor 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