summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
diff options
context:
space:
mode:
authorJosh Price <thepig247@gmail.com>2016-05-24 12:35:21 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-24 13:03:08 +0200
commit8f7d01632cd79957fe42ea37103ca9b91a1c54f5 (patch)
tree79c734d0733bd752f2910c5da6a24e6080d0a6f9 /testsuite/tests/parser
parent1bf5c126c028285911138454689ea8068a7f9c37 (diff)
downloadhaskell-8f7d01632cd79957fe42ea37103ca9b91a1c54f5.tar.gz
Add support for unicode TH quotes (#11743)
I've also added cases for `IToparenbar` and `ITcparenbar` (aka banana brackets) to `isUnicode`. Document unicode TH quote alternatives (#11743) Test Plan: ./validate Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2185 GHC Trac Issues: #11743
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/unicode/all.T2
-rw-r--r--testsuite/tests/parser/unicode/arrowsyntax.hs34
-rw-r--r--testsuite/tests/parser/unicode/brackets.hs43
3 files changed, 44 insertions, 35 deletions
diff --git a/testsuite/tests/parser/unicode/all.T b/testsuite/tests/parser/unicode/all.T
index 44adc7d797..cd69f0d161 100644
--- a/testsuite/tests/parser/unicode/all.T
+++ b/testsuite/tests/parser/unicode/all.T
@@ -27,4 +27,4 @@ test('T7671', normal, compile, [''])
test('T10907', normal, compile, [''])
test('T7650', normal, compile, [''])
-test('arrowsyntax', normal, compile, [''])
+test('brackets', normal, compile, [''])
diff --git a/testsuite/tests/parser/unicode/arrowsyntax.hs b/testsuite/tests/parser/unicode/arrowsyntax.hs
deleted file mode 100644
index 05a8495167..0000000000
--- a/testsuite/tests/parser/unicode/arrowsyntax.hs
+++ /dev/null
@@ -1,34 +0,0 @@
-{-# LANGUAGE Arrows #-}
-{-# LANGUAGE UnicodeSyntax #-}
-
--- See Trac #2978 and #10162 for details
--- This test is a unicode version of tests/arrows/should_compile/arrowform1.hs
-
-module ShouldCompile where
-
-import Control.Arrow
-
-handle :: ArrowPlus a => a (b,s) c -> a (b,(String,s)) c -> a (b,s) c
-handle f h = proc (b,s) -> (f ⤙ (b,s)) <+> (h ⤙ (b,("FAIL",s)))
-
-f :: ArrowPlus a => a (Int,Int) String
-f = proc (x,y) ->
- ⦇handle
- (returnA ⤙ show y)
- (\s -> returnA ⤙ s ++ show x)
- ⦈
-
-g :: ArrowPlus a => a (Int,Int) String
-g = proc (x,y) ->
- ⦇handle
- (\msg -> returnA ⤙ msg ++ show y)
- (\s msg -> returnA ⤙ s ++ show x)
- ⦈ ("hello " ++ show x)
-
-h :: ArrowPlus a => a (Int,Int) Int
-h = proc (x,y) ->
- (
- (\z -> returnA ⤙ x + z)
- <+>
- (\z -> returnA ⤙ y + z)
- ) (x*y)
diff --git a/testsuite/tests/parser/unicode/brackets.hs b/testsuite/tests/parser/unicode/brackets.hs
new file mode 100644
index 0000000000..33c8e3f44f
--- /dev/null
+++ b/testsuite/tests/parser/unicode/brackets.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE Arrows #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE UnicodeSyntax #-}
+
+-- See Trac #10162 and #11743 for details
+
+module ShouldCompile where
+
+import Control.Arrow
+import Language.Haskell.TH
+
+handle :: ArrowPlus a => a (b,s) c -> a (b,(String,s)) c -> a (b,s) c
+handle f h = proc (b,s) -> (f -< (b,s)) <+> (h -< (b,("FAIL",s)))
+
+f :: ArrowPlus a => a (Int,Int) String
+f = proc (x,y) ->
+ ⦇handle
+ (returnA -< show y)
+ (\s -> returnA -< s ++ show x)
+ ⦈
+
+g :: ArrowPlus a => a (Int,Int) String
+g = proc (x,y) ->
+ ⦇handle
+ (\msg -> returnA -< msg ++ show y)
+ (\s msg -> returnA -< s ++ show x)
+ ⦈ ("hello " ++ show x)
+
+h :: ArrowPlus a => a (Int,Int) Int
+h = proc (x,y) ->
+ (
+ (\z -> returnA -< x + z)
+ <+>
+ (\z -> returnA -< y + z)
+ ) (x*y)
+
+
+matches :: PatQ -> ExpQ
+matches pat = ⟦\x ->
+ case x of
+ $pat -> True
+ _ -> False
+ ⟧