blob: 97e9961f04beb08afc96f2ee528feeceb27cc178 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
|