From 58e05c8c9eada9773f466edf97e37546c60c8870 Mon Sep 17 00:00:00 2001
From: Matthew Pickering <matthewtpickering@gmail.com>
Date: Wed, 7 Oct 2015 20:36:38 -0500
Subject: [PATCH] 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
---
 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(-)
 create mode 100644 testsuite/tests/patsyn/should_compile/T10747.hs

diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 3ac0da32ccca..861d5b98c86a 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 000000000000..b02d8d0d87a0
--- /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 db6cfb57ec79..95291331140c 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, [''])
-- 
GitLab