为什么这个内射型家庭实际上不是内射型?

时间:2019-04-05 21:28:08

标签: haskell ghc type-families

我尝试过:

{-# LANGUAGE TypeFamilyDependencies #-}
module Injective where

type family F (a :: *) = (fa :: *) | fa -> a

convert :: F a ~ F b => a -> b
convert x = x

GHC 8.6.4给了我这个错误

    • Could not deduce: a ~ b
      from the context: F a ~ F b
        bound by the type signature for:
                   convert :: forall a b. (F a ~ F b) => a -> b
        at Injective.hs:6:1-30

为什么?内射性的整个点肯定是一个 可以从a ~ b推论出F a ~ F b吗?

1 个答案:

答案 0 :(得分:3)

事实证明这是a known issue in GHC。显然,这是因为尚未证明它是声音。