【发布时间】:2016-08-28 10:12:44
【问题描述】:
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)
【问题讨论】:
-
在显式类型绑定中出现此 errorType 错误 *** 术语:createAccount *** 类型:IO ([Char],[Char],[Char],[Char],[Char]) * ** 不匹配:IO () -> 记录
-
似乎没有任何理由得到门牌号;
createAccount不用。