나는 하스켈에서 프로그래밍을하려고합니다. 파일을 읽고 라인 함수를 사용하여 파일의 모든 라인을 목록에 넣으려고합니다. 나는이 오류가 점점 계속, 그러나readFile 뒤에 행 사용
file = "muh.rtr"
readTrack :: String -> Track
readTrack file =
do let defFile = readFile file
let fileLines = lines defFile
을 : 여기에 일부 코드는
Parser.hs:22:39:
Couldn't match expected type `String' with actual type `IO String'
In the first argument of `lines', namely `defFile'
In the expression: lines defFile
In an equation for `fileLines': fileLines = lines defFile
지금 어딘가에 몇 가지 답을 찾으려 시간 동안 인터넷을 검색 한을하지만 난 너무 운이없는 것 지금까지.
[답변은] (http : // stackoverflow.com/questions/12664050/works-in-ghci-but-not-loaded/12665589 # 12665589) 나는 당신과 같은 오류 메시지를받는 사람에게주었습니다. – AndrewC