我有一个动态的txt文件的例子(1,1,1),我试图从文件中读取它们,并将它们传递给问题函数。
函数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))
无法将预期类型'Int'与实际类型'(Int,Int,Int)'相符
1条答案
按热度按时间tkclm6bt1#
您需要提取三个
Int
值,以便将它们分别传递给problem
。相反地,您可以定义
uncurry3
函数来调整problem
以使用元组。