我定义了一个枚举:
data Direction = Clockwise | CounterClockwise deriving (Enum)
变量'方向'有类型'方向'。在进行以下比较时:
direction == Clockwise
我收到此错误:
No instance for (Eq OrbitDirection) arising from a use of `=='
In the expression: direction == Clockwise
答案 0 :(得分:7)
这很简单:将Eq
实例添加到派生实例列表中:
data Direction = Clockwise | CounterClockwise deriving (Enum, Eq)