Pattern match failures give no hints about the errant value or call location
Program: https://code.world/haskell#PbzAjsCnBebT4VmPRIGpp7g
Message:
program.hs:(26,1)-(27,29): Non-exhaustive patterns in function nth
Interesting that even adding HasCallStack to the function constraint doesn't yield a stack trace for a pattern match failure.
Worth noting that -Wincomplete-patterns does tell you exactly which pattern was missing. Perhaps we could leverage that somehow.
Interesting idea. I don't think it's a good idea to just enable the warning. I could see a situation where one captures the warning, feed it back at runtime somehow, and then the pattern match failure looks up the warning and adds that info. Seems pretty complex, though. If you were going to make this change, seems better to do it in GHC.
Filed against GHC: https://gitlab.haskell.org/ghc/ghc/issues/17998