[GHC] #9889: Pattern synonym does not work in top-level pattern bind (was: Pattern synonym does not work at top level)

GHC ghc-devs at haskell.org
Wed Dec 17 12:24:05 UTC 2014


#9889: Pattern synonym does not work in top-level pattern bind
-------------------------------------+-------------------------------------
              Reporter:  goldfire    |            Owner:  cactus
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.9
  (Type checker)                     |         Keywords:  PatternSynonyms
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:  GHC         |  Related Tickets:
  rejects valid program              |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by cactus):

 * failure:  None/Unknown => GHC rejects valid program
 * component:  Compiler => Compiler (Type checker)


Old description:

> When I say
>
> {{{
> pattern Id x = x
>
> Id x = True
> }}}
>
> I get
>
> {{{
>     Not in scope: data constructor ‘Id’
> }}}
>
> This happens with both 7.8.3 and HEAD.

New description:

 When I say

 {{{
 {-# LANGUAGE PatternSynonyms #-}
 pattern Id x = x

 Id x = True
 }}}

 I get

 {{{
     Not in scope: data constructor ‘Id’
 }}}

 This happens with both 7.8.3 and HEAD.

--

Comment:

 Note that pattern binds, in general, don't have this problem, only at the
 top level; e.g. the following works as expected:

 {{{
 {-# LANGUAGE PatternSynonyms #-}
 pattern Id x = x

 foo = x
   where
     Id x = True
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9889#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list