codeworld icon indicating copy to clipboard operation
codeworld copied to clipboard

Pattern match failures give no hints about the errant value or call location

Open codeworld-feedback opened this issue 6 years ago • 4 comments

Program: https://code.world/haskell#PbzAjsCnBebT4VmPRIGpp7g

Message:

program.hs:(26,1)-(27,29): Non-exhaustive patterns in function nth

codeworld-feedback avatar Dec 12 '19 23:12 codeworld-feedback

Interesting that even adding HasCallStack to the function constraint doesn't yield a stack trace for a pattern match failure.

cdsmith avatar Dec 13 '19 05:12 cdsmith

Worth noting that -Wincomplete-patterns does tell you exactly which pattern was missing. Perhaps we could leverage that somehow.

josephcsible avatar Mar 06 '20 16:03 josephcsible

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.

cdsmith avatar Mar 09 '20 19:03 cdsmith

Filed against GHC: https://gitlab.haskell.org/ghc/ghc/issues/17998

cdsmith avatar Apr 02 '20 04:04 cdsmith