
#9953: Pattern synonyms don't work with GADTs -------------------------------------+------------------------------------- Reporter: simonpj | Owner: cactus Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler (Type | Version: 7.10.1-rc1 checker) | Keywords: Resolution: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by cactus): Here's a hopefully more enlightening description of the problem in ticket:9953#comment:6. Suppose we have this setup: {{{#!hs {-# LANGUAGE GADTs, PatternSynonyms, ViewPatterns #-} data X t where Y :: a -> X (Maybe a) f :: (Eq a) => a -> a f = id -- inferred type: -- pattern C1 :: t ~ Maybe a => a -> X t pattern C1 x = Y x pattern C2 :: a -> X (Maybe a) pattern C2 x = Y x pattern C3 :: () => (Eq a) => a -> X (Maybe a) pattern C3 x = Y (f -> x) }}} The difference between `C1`'s inferred type and `C2`'s type is the subject of this ticket; with the point being that we should be reconstructing `C1`'s type from the signature given for `C2`. The types of the matchers generated are as follows: {{{#!hs $mC1 :: forall r t. X t -> (forall a. (t ~ Maybe a) => a -> r) -> (Void# -> r) -> r $mC2 :: forall r a. X (Maybe a) -> ( a -> r) -> (Void# -> r) -> r $mC3 :: forall r a. (Eq a) => X (Maybe a) -> ( a -> r) -> (Void# -> r) -> r }}} If `C2` got the same type as `C1`, what would be the analogous type for `C3`? What would be `$mC3`'s type in that case? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9953#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler