[GHC] #11367: [Regression] Only one clause allowed in (explicitly bidirectional) pattern synonyms

GHC ghc-devs at haskell.org
Thu Jan 7 08:50:55 UTC 2016


#11367: [Regression] Only one clause allowed in (explicitly bidirectional) pattern
synonyms
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Well in normal code you can't write
 {{{
 f :: Int -> Int
 }}}
 and omit the declaration of `f`.  You have to write
 {{{
 f :: Int -> Int
 f = undefined
 }}}
 So it's consistent to require the same for pattern synonyms.

 Usually `where` clauses contain zero or more bindings, which is why an
 empty `where` is usually ok.  But here it must contain exactly one.  (Two
 would not make sense either.)

 For my money, I think it's maybe a mistake for the
 unidirectional/bidirectional split to be so quietly signaled.  One could
 imagine
 {{{
 pattern unidirectional Q a = pat
 pattern bidirectional P a b = pat
 pattern bidirectional R x = pat where R = ...
 }}}
 But opinions vary.

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


More information about the ghc-tickets mailing list