summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBodigrim <andrew.lelechenko@gmail.com>2019-11-21 20:04:33 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-05 16:07:47 -0500
commit8324f0b7357c428f505dccbc84bb7dde897b509c (patch)
tree11ffe59c3df5caf68f7f499308999485b03ce39d
parent4e47217f85b2006f03e72d0a550fe2cca26cfd93 (diff)
downloadhaskell-8324f0b7357c428f505dccbc84bb7dde897b509c.tar.gz
Test proxy-polymorphic sameNat and sameSymbol
-rw-r--r--testsuite/tests/lib/base/T17310.hs24
-rw-r--r--testsuite/tests/lib/base/all.T1
2 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/lib/base/T17310.hs b/testsuite/tests/lib/base/T17310.hs
new file mode 100644
index 0000000000..97e9961f04
--- /dev/null
+++ b/testsuite/tests/lib/base/T17310.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE KindSignatures #-}
+
+module Lib where
+
+import Data.Type.Equality
+import GHC.TypeLits
+import GHC.TypeNats
+
+data A (t :: Nat) = A
+data B (t :: Nat) = B
+data C (t :: Symbol) = C
+data D (t :: Symbol) = D
+
+cmpNats :: (KnownNat n, KnownNat m) => A n -> B m -> Bool
+cmpNats a b = case a `sameNat` b of
+ Nothing -> False
+ Just Refl -> True
+
+cmpSymbols :: (KnownSymbol n, KnownSymbol m) => C n -> D m -> Bool
+cmpSymbols c d = case c `sameSymbol` d of
+ Nothing -> False
+ Just Refl -> True
diff --git a/testsuite/tests/lib/base/all.T b/testsuite/tests/lib/base/all.T
index e368dcad60..f6770cf91a 100644
--- a/testsuite/tests/lib/base/all.T
+++ b/testsuite/tests/lib/base/all.T
@@ -1,3 +1,4 @@
test('T16586', normal, compile_and_run, ['-O2'])
# Event-manager not supported on Windows
test('T16916', when(opsys('mingw32'), skip), compile_and_run, ['-O2 -threaded'])
+test('T17310', normal, compile, [''])