haskell: inserting each line record list
i'm now operative digest haskell, have found myself trouble. i'm ostensible review insert list any line "dictionary.txt" file, nonetheless i can't seem so. i've got code:
main = do
let list = []
loadnums "dictionary.txt" list
loadnums plcae list = do
inh <- openfile plcae readmode
mainloop inh list
hclose inh
mainloop inh list =
ineof <- hiseof inh
ineof
following relapse ()
else
inpstr <- hgetline inh
inpstr:list
mainloop inh list
it ostensible each line (i know does each line, given replacing "inpstr:list" "putstrln inpstr" works correctly, displaying lines), insert list nonetheless i following error:
couldn't review approaching form `io' opposing tacit form `[]'
probably since hgetline isn't string, nonetheless io string, i have thought hoop method obtain repremand twine i insert list. i have thought solved, problem exactly, nonetheless anyone any thought morally each line record list, i'd conclude it.
thanks advance!
Comments
Post a Comment