如何从“ BoundedEnum a”派生“ BoundedEnum(也许是a)”?

时间:2019-07-09 22:14:29

标签: purescript

我在“找不到Data.Enum.BoundedEnum (Maybe InstitutionContactType)的类型类实例的错误”,但是由于存在instance enumMaybe :: BoundedEnum a => Enum (Maybe a)instance boundedMaybe :: Bounded a => Bounded (Maybe a)instance boundedEnumInstitutionContactType :: BoundedEnum InstitutionContactType,我会认为这应该可行,尽管也许是因为我在enumMaybe中所需要的方向是错误的?

boundedMaybe给我们Bounded (Maybe a)enumMaybe给我们Enum (Maybe a),并且给定class (Bounded a, Enum a) <= BoundedEnum aBounded (Maybe a)Enum (Maybe a)应该,还给了我们BoundedEnum (Maybe a),我认为我的方向性正确,如果我理解正确的话,实例和类在需要提供的内容方面是相反的。

1 个答案:

答案 0 :(得分:0)

当然,我终于意识到这是行不通的,因为BoundedEnumBounded中已有的成员需要另外三个成员来实现