[GHC] #12872: Pattern synonyms allow multiple type signatures but only use the first

#12872: Pattern synonyms allow multiple type signatures but only use the first -------------------------------------+------------------------------------- Reporter: jophish | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC accepts Unknown/Multiple | invalid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- GHC seems to only be using the first signature for pattern synonyms GHC 8.0.2 allows this to compile: {{{#!hs {-# LANGUAGE PatternSynonyms #-} module Pattern where pattern Foo :: () pattern Foo :: Bool pattern Foo = () }}} but not this: {{{#!hs {-# LANGUAGE PatternSynonyms #-} module Pattern where pattern Foo :: Bool pattern Foo :: () pattern Foo = () }}} This compiles and ghci tells me the type of `Foo` is `()`: {{{#!hs {-# LANGUAGE PatternSynonyms #-} module Pattern where pattern Foo :: () pattern Foo :: Bool pattern Foo <- _ where Foo = undefined }}} This doesn't compile (as expected): {{{#!hs {-# LANGUAGE PatternSynonyms #-} module Pattern where pattern Foo :: () pattern Foo :: Bool Bool pattern Foo = () }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12872 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12872: Pattern synonyms allow multiple type signatures but only use the first -------------------------------------+------------------------------------- Reporter: jophish | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): This is fixed in HEAD. {{{ [1 of 1] Compiling Pattern (.hs -> .o) test.hs:5:10: error: Duplicate pattern synonym signatures for ‘Foo’ at test.hs:4:10-12 test.hs:5:10-12 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12872#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12872: Pattern synonyms allow multiple type signatures but only use the first -------------------------------------+------------------------------------- Reporter: jophish | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: duplicate | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * keywords: => PatternSynonyms * status: new => closed * resolution: => duplicate -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12872#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC