type Record=([Char],[Char],[Char],[Char],[Char])
createAccount::IO()->Record
createAccount=do
putStrLn "Enter First Name"
fname<-getLine
putStrLn "Enter Last Name"
lname<-getLine
putStrLn "Enter State"
state<-getLine
putStrLn "Enter City"
city<-getLine
putStrLn "Enter House No."
hnum<-getLine
let hnumInt = read hnum :: Integer
putStrLn "Enter Contact"
contact<-getLine
return (fname,lname,state,city,contact)
答案 0 :(得分:5)
错误消息是createAccount
的类型签名实际上是:
createAccount :: IO ([Char],[Char],[Char],[Char],[Char])
不是你声明的IO() -> Record
。
修复它的选项:
IO ([Char],[Char],[Char],[Char],[Char])
(或等效:IO Record
)