summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
diff options
context:
space:
mode:
authorJosh Price <joshprice247+git@gmail.com>2016-03-23 16:19:01 +0100
committerBen Gamari <ben@smart-cactus.org>2016-03-24 10:53:27 +0100
commit03a1bb4d010f94bed233ca261bf44e00c7bd9878 (patch)
tree890d30986fc232bc3715d3a39ec5aea73b430755 /testsuite/tests/parser
parent2708c22b8c8a415446d963575c0396a038b43a93 (diff)
downloadhaskell-03a1bb4d010f94bed233ca261bf44e00c7bd9878.tar.gz
Add unicode syntax for banana brackets
Summary: Add "⦇" and "⦈" as unicode alternatives for "(|" and "|)" respectively. This must be implemented differently than other unicode additions because ⦇" and "⦈" are interpretted as a $unigraphic rather than a $unisymbol. Test Plan: validate Reviewers: goldfire, bgamari, austin Reviewed By: bgamari, austin Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2012 GHC Trac Issues: #10162
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/unicode/all.T2
-rw-r--r--testsuite/tests/parser/unicode/arrowsyntax.hs34
2 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/parser/unicode/all.T b/testsuite/tests/parser/unicode/all.T
index 36554cc143..6876fe777c 100644
--- a/testsuite/tests/parser/unicode/all.T
+++ b/testsuite/tests/parser/unicode/all.T
@@ -26,3 +26,5 @@ test('T7671', normal, compile, [''])
# supported by the test suite (see 10907)
test('T10907', normal, compile, [''])
test('T7650', normal, compile, [''])
+
+test('arrowsyntax', normal, compile, ['']) \ No newline at end of file
diff --git a/testsuite/tests/parser/unicode/arrowsyntax.hs b/testsuite/tests/parser/unicode/arrowsyntax.hs
new file mode 100644
index 0000000000..05a8495167
--- /dev/null
+++ b/testsuite/tests/parser/unicode/arrowsyntax.hs
@@ -0,0 +1,34 @@
+{-# 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)