可以匹配预期的类型‘ int’使用实际类型(int,int,int)
我有一个动态的txt文件示例(1,1,1),我试图从文件中读取它们 将它们传递到问题功能。
函数问题:: int-> int-> int-> [int]
args <- getArgs
contents <- readFile (head args)
let value = read contents::(Int,Int,Int)
//print(show(problem 1 1 1))
print(show(problem value))
无法匹配预期的类型'int' 使用实际类型'(int,int,int)'
i have a dynamic txt file example (1,1,1), im trying to read them from file
to pass them to problem function.
function problem :: Int->Int->Int->[Int]
args <- getArgs
contents <- readFile (head args)
let value = read contents::(Int,Int,Int)
//print(show(problem 1 1 1))
print(show(problem value))
Couldn't match expected type ‘Int’
with actual type ‘(Int, Int, Int)’
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要提取三个
int
值,以便将它们单独传递到问题
。相反,您可以定义
uncurry3
函数以适应问题
与元组一起使用。You need to extract the three
Int
values in order to pass them individually toproblem
.Conversely, you could define an
uncurry3
function to adaptproblem
to work with a tuple.