How to catch errors/unsolved constraints from GHC type checker?