'idiomatic' Haskell type inequality

后端 未结 2 1564
孤街浪徒
孤街浪徒 2021-01-14 12:15

(edited from previous question where I thought code below doesn\'t work)

I wish to implement a haskell function f that has a restriction such that its 2 parameters m

2条回答
  •  日久生厌
    2021-01-14 12:30

    With new features being added to GHC, you'll be able to write:

    {-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-}
    
    type family Equal (a :: k) (b :: k) :: Bool
    type instance where
       Equal a a = True
       Equal a b = False
    

提交回复
热议问题