【发布时间】:2018-12-03 00:02:55
【问题描述】:
似乎将Complex Int 提升为权力在其实例中违反了某些合同。我错了吗?
下面的小例子
compl :: Complex Int -> Maybe (Complex Int)
compl d = (d^) <$> Just 3
还有错误信息:
No instance for (RealFloat Int) arising from an operator section
In the first argument of ‘(<$>)’, namely ‘(d ^)’
In the expression: (d ^) <$> Just 3
In an equation for ‘compl’: compl d = (d ^) <$> Just 3
有没有办法解决这个问题?允许这种类型为浮点数在我的程序中没有任何意义。
【问题讨论】:
标签: haskell types casting complex-numbers