[GHC] #11987: Allow record wildcards with pattern synonyms which are defined in GHCi

GHC ghc-devs at haskell.org
Sat Sep 24 14:35:54 UTC 2016


#11987: Allow record wildcards with pattern synonyms which are defined in GHCi
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by gelisam):

 I can reproduce the problem outside of ghci, but only if the pattern
 synonym is defined in a separate file:

 {{{#!hs
 {-# LANGUAGE NamedFieldPuns, PatternSynonyms, RecordWildCards #-}
 module Point where

 pattern Point :: Int -> Int -> (Int, Int)
 pattern Point{x, y} = (x, y)

 -- works
 sameFile :: (Int,Int)
 sameFile = let { x = 1; y = 2 } in Point { .. }
 }}}

 {{{#!hs
 {-# LANGUAGE NamedFieldPuns, PatternSynonyms, RecordWildCards #-}
 module Test where

 import Point

 -- works
 namedFieldPuns :: (Int,Int)
 namedFieldPuns = let { x = 1; y = 2 } in Point { x, y }

 -- error: Pattern synonym ‘Point’ used as a data constructor
 recordWildCards :: (Int,Int)
 recordWildCards = let { x = 1; y = 2 } in Point { .. }
 }}}

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


More information about the ghc-tickets mailing list