我在Haskell中實現了一個計算器來刷新語言,但是當我想讓它進入一個無限循環時,我在主要中遇到了一個障礙,直到用戶輸入q
。 繼承人我主要讓我知道,如果你看到我在做什麼錯誤和虐待還張貼我的錯誤Haskell無限循環
error: No instances for (Floating (IO a0), Read (IO a0))
arising from a use of `compute'
Possible fix:
add instance declarations for (Floating (IO a0), Read (IO a0))
In a stmt of a 'do' block: compute e
In the expression:
do { compute e;
evaluate_input }
In an equation for `evaluate_expression':
evaluate_expression e
= do { compute e;
evaluate_input }
哪裏'compute'的定義是什麼? – us2012 2013-02-26 00:02:02
在某些時候,您正嘗試'讀取'IO x類型的值,可能在您沒有打算髮布的函數中。好消息是,GHC應該正確地告訴你*哪一行導致錯誤:) – 2013-02-26 00:02:51
@ us2012 compute ::(讀取a,數字a,小數a,浮點數a)=>字符串 - > a – CodeNewbie 2013-02-26 00:09:32