Advertisement
Guest User

Untitled

a guest
Feb 28th, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {-# LANGUAGE DataKinds    #-}
  2. {-# LANGUAGE TypeFamilies #-}
  3.  
  4. import           Data.Coerce (Coercible)
  5. import           Data.Kind   (Constraint, Type)
  6. import           Data.Proxy  (Proxy)
  7.  
  8. data DistinctInstancesTrue k a b
  9. data DistinctInstancesFalse
  10.  
  11. type family DistinctInstances (k :: Type -> Constraint) (a :: Type) (b :: Type) where
  12.   DistinctInstances k a a = DistinctInstancesFalse
  13.   DistinctInstances k a b = DistinctInstancesTrue k a b
  14.  
  15. proof :: (k a, k b) => DistinctInstancesTrue k a b -> Bool
  16. proof _  = True
  17.  
  18. main = do
  19.   print $ proof (undefined :: DistinctInstances Num Int Float)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement