Ticket #2204 (new feature request)

Opened 5 years ago

Last modified 3 years ago

Improve 'patterns not matched' warnings

Reported by: Deewiant Owned by:
Priority: low Milestone: _|_
Component: Compiler Version: 6.8.2
Keywords: Cc: marcot@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Compiling the following with -fwarn-incomplete-patterns:

module Asdf where

f :: String -> Int
f "0" = 0

g :: Int -> Int
g 0 = 0

Yields:

asdf.hs:4:0:
    Warning: Pattern match(es) are non-exhaustive
             In the definition of `f':
                 Patterns not matched:
                     []
                     (GHC.Base.C# #x) : _ with #x `notElem` ['0']
                     (GHC.Base.C# '0') : (_ : _)

asdf.hs:7:0:
    Warning: Pattern match(es) are non-exhaustive
             In the definition of `g':
                 Patterns not matched: GHC.Base.I# #x with #x `notElem` [0#]

Losing the 'GHC.Base' stuff along with the various octothorpes would make the error messages a lot nicer. Ideally it'd be something like Patterns not matched: x where x notElem [0] for the second case, for instance.

Attachments

Asdf.hs Download (73 bytes) - added by morabbin 4 months ago.
Exhibits problems described in #2204

Change History

Changed 5 years ago by simonpj

  • priority changed from normal to low
  • difficulty set to Unknown
  • milestone set to _|_

Yes indeed. I think it'd make sense to do this as part of #595. Which is currently awaiting a keen author.

Simon

Changed 5 years ago by ross

  • type changed from proposal to feature request

Changed 5 years ago by simonmar

  • architecture changed from Multiple to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Multiple to Unknown/Multiple

Changed 3 years ago by marcotmarcot

  • cc marcot@… added
  • failure set to None/Unknown

Changed 4 months ago by morabbin

Exhibits problems described in #2204

Note: See TracTickets for help on using tickets.