小编Pot*_*mpo的帖子

无法将Complex Int提升到电源

似乎提高Complex Int权力违反了某些合同.我错了吗?

以下最小例子

compl :: Complex Int -> Maybe (Complex Int)
compl d = (d^) <$> Just 3
Run Code Online (Sandbox Code Playgroud)

并且错误消息:

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
Run Code Online (Sandbox Code Playgroud)

有没有办法解决?允许这种类型是浮点数在我的程序中没有任何意义.

haskell types casting complex-numbers

1
推荐指数
1
解决办法
43
查看次数

标签 统计

casting ×1

complex-numbers ×1

haskell ×1

types ×1