我尝试过:
{-# 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
吗?