2
這是一個非常愚蠢的問題,但我有點失落。這裏的功能在整數類型之間轉換
f :: (Bool,Int) -> Int
f (True,n) = round (2 ** n)
f (False,n) = 0
而這裏的我得到
No instance for (Floating Int)
arising from a use of `**'
Possible fix: add an instance declaration for (Floating Int)
In the first argument of `round', namely `(2 ** n)'
In the expression: round (2 ** n)
In an equation for `f': f (True, n) = round (2 ** n)
我要補充,使其工作的錯誤?