diff options
author | Bodigrim <andrew.lelechenko@gmail.com> | 2019-11-21 20:04:33 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-12-05 16:07:47 -0500 |
commit | 8324f0b7357c428f505dccbc84bb7dde897b509c (patch) | |
tree | 11ffe59c3df5caf68f7f499308999485b03ce39d /testsuite/tests/lib | |
parent | 4e47217f85b2006f03e72d0a550fe2cca26cfd93 (diff) | |
download | haskell-8324f0b7357c428f505dccbc84bb7dde897b509c.tar.gz |
Test proxy-polymorphic sameNat and sameSymbol
Diffstat (limited to 'testsuite/tests/lib')
-rw-r--r-- | testsuite/tests/lib/base/T17310.hs | 24 | ||||
-rw-r--r-- | testsuite/tests/lib/base/all.T | 1 |
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, ['']) |