Opened 11 years ago

Closed 6 years ago

#700 closed bug (fixed)

Inconsistent typechecking of pattern match in function binding

Reported by: guest Owned by:
Priority: normal Milestone: 7.0.1
Component: Compiler Version: 6.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_compile/T700
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


f,g :: (forall a. Maybe a) -> (forall a. a)
f x = case x of Just y -> y
g (Just y) = y

f is accepted by 6.4.1, but g isn't. I think g should also be accepted.

Change History (7)

comment:1 Changed 11 years ago by simonpj

  • Priority changed from normal to lowest

Yes, this is a little-used feature that I removed subsequent to GHC 6.4.

Implementing it requires instantiation inside patterns, which was jolly tricky to implement, and all the more so when combined with GADTs etc. And the pain just didn't seem worth the gain; are you really going to have arguments with type (forall a. Maybe a)?

Bottom line: I don't propose to change this unless there are some pretty convincing examples of how useful it'd be. I'm guessing they are hard to find, but I could be wrong.

I'll leave this open, but with verylow priority


comment:2 Changed 10 years ago by igloo

  • Milestone set to _|_

comment:3 Changed 10 years ago by simonpj

Just to add: recent changes to GHC have made it pretty easy to restore the previous behaviour. It's not a big deal; just an hour or so.


comment:4 Changed 8 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:5 Changed 8 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:6 Changed 7 years ago by igloo

  • Milestone changed from _|_ to 6.14.1
  • Priority changed from lowest to normal
  • Type of failure set to None/Unknown

If it's now easy to fix then I think it's probably worth doing. The current behaviour does seem inconsistent.

comment:7 Changed 6 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to typecheck/should_compile/T700

Works fine with the new typechecker.


Note: See TracTickets for help on using tickets.