diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2015-10-07 20:36:38 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-10-07 20:37:08 -0500 |
commit | 69a6e4258786894578ffed2a1d907a74c52d779b (patch) | |
tree | 8b6a89db9bad2632288e73622756d31dd1f7e735 | |
parent | 7b443bb1df8f7f0a6b3124537590aa655a9300cd (diff) | |
download | haskell-69a6e4258786894578ffed2a1d907a74c52d779b.tar.gz |
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
-rw-r--r-- | compiler/parser/Parser.y | 2 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_compile/T10747.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_compile/all.T | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 7e7f5792d9..7079a949f1 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1148,7 +1148,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 0000000000..b02d8d0d87 --- /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 b0776ac9a4..5e86a99cca 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -24,3 +24,4 @@ test('T9889', normal, compile, ['']) test('T9867', normal, compile, ['']) test('T9975a', normal, compile_fail, ['']) test('T9975b', normal, compile, ['']) +test('T10747', normal, compile, ['']) |