[commit: ghc] master: Test Trac #11336 (256c2cf)

git at git.haskell.org git at git.haskell.org
Sat Jan 2 22:09:51 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/256c2cfc1e3690cb4b07154b3a81d89d45625685/ghc

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

commit 256c2cfc1e3690cb4b07154b3a81d89d45625685
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Sat Jan 2 22:09:21 2016 +0000

    Test Trac #11336


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

256c2cfc1e3690cb4b07154b3a81d89d45625685
 testsuite/tests/patsyn/should_compile/T11336.hs | 36 +++++++++++++++++++++++++
 testsuite/tests/patsyn/should_compile/all.T     |  1 +
 2 files changed, 37 insertions(+)

diff --git a/testsuite/tests/patsyn/should_compile/T11336.hs b/testsuite/tests/patsyn/should_compile/T11336.hs
new file mode 100644
index 0000000..3f30993
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T11336.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE ViewPatterns #-}
+
+module Bug where
+
+data AST s a
+  where
+    Sym  :: s a -> AST s a
+    (:$) :: AST s (a -> b) -> AST s a -> AST s b
+
+data A sig where A :: A (a -> a)
+data B sig where B :: B (a -> a)
+
+data AB a
+  where
+    AA :: A a -> AB a
+    BB :: B a -> AB a
+
+class Prj s where prj :: AB a -> Maybe (s a)
+
+instance Prj A
+  where
+    prj (AA s) = Just s
+    prj _      = Nothing
+
+instance Prj B
+  where
+    prj (BB s) = Just s
+    prj _      = Nothing
+
+pattern SymP s <- Sym (prj -> Just s)
+
+fun :: AST AB a -> AST AB a
+fun (SymP A :$ _) = undefined
+fun (SymP B :$ _) = undefined
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index 880d6b2..5205a24 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -47,3 +47,4 @@ test('T10897', normal, multi_compile, ['T10897', [
 test('T11224b', normal, compile, [''])
 test('MoreEx', normal, compile, [''])
 test('T11283', normal, compile, [''])
+test('T11336', normal, compile, [''])



More information about the ghc-commits mailing list