[commit: ghc] ghc-7.10: Allow non-operator infix pattern synonyms (58e05c8)

git at git.haskell.org git at git.haskell.org
Thu Oct 22 15:06:47 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/58e05c8c9eada9773f466edf97e37546c60c8870/ghc

>---------------------------------------------------------------

commit 58e05c8c9eada9773f466edf97e37546c60c8870
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Wed Oct 7 20:36:38 2015 -0500

    Allow non-operator infix pattern synonyms
    
    For example
    
    ```
    pattern head `Cons` tail = head : tail
    ```
    
    Reviewed By: goldfire, austin
    
    Differential Revision: https://phabricator.haskell.org/D1295
    
    GHC Trac Issues: #10747


>---------------------------------------------------------------

58e05c8c9eada9773f466edf97e37546c60c8870
 compiler/parser/Parser.y                        | 2 +-
 testsuite/tests/patsyn/should_compile/T10747.hs | 5 +++++
 testsuite/tests/patsyn/should_compile/all.T     | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 3ac0da3..861d5b9 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1058,7 +1058,7 @@ pattern_synonym_decl :: { LHsDecl RdrName }
 
 pattern_synonym_lhs :: { (Located RdrName, HsPatSynDetails (Located RdrName)) }
         : con vars0 { ($1, PrefixPatSyn $2) }
-        | varid consym varid { ($2, InfixPatSyn $1 $3) }
+        | varid conop varid { ($2, InfixPatSyn $1 $3) }
 
 vars0 :: { [Located RdrName] }
         : {- empty -}                 { [] }
diff --git a/testsuite/tests/patsyn/should_compile/T10747.hs b/testsuite/tests/patsyn/should_compile/T10747.hs
new file mode 100644
index 0000000..b02d8d0
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T10747.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE PatternSynonyms #-}
+
+module T10747 where
+
+pattern head `Cons` tail = head : tail
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index db6cfb5..9529133 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -21,3 +21,4 @@ test('T8968-3', normal, compile, [''])
 test('ImpExp_Imp', [extra_clean(['ImpExp_Exp.hi', 'ImpExp_Exp.o'])], multimod_compile, ['ImpExp_Imp', '-v0'])
 test('T9857', normal, compile, [''])
 test('T9889', normal, compile, [''])
+test('T10747', normal, compile, [''])



More information about the ghc-commits mailing list