[#450] Add Util.Main module
Description
Problem: we typically apply 2 functions to main
: withUtf8
and
displayUncaughtException
. Maybe one day we'll have something else.
So it's a good idea to group them into a helper function to make
sure we won't forget one of them and to make it easier to add another
customization later.
Also we are using our own displayUncaughtException
helper right now,
but an equivalent function is exposed from the uncaught-exception
package.
Solution:
- Create
Util.Main
module withwrapMain
that applies both aforementioned wrappers. - Use
withDisplayExceptionHandler
fromuncaught-exception
. We prefer it overdisplayUncaughtException
from the same library because it's supposed to work better in multi-threaded applications. We don't have many of them, but we have some (e. g.morley-client
). - Update all
Main
modules accordingly.
Note: this package is not in Stackage LTS yet, but it's in Nightly and will be added to the next major LTS.
Related issue(s)
Resolves #450 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.