我试图在Haskell中正确读取文件,但我似乎得到了这个错误.
***例外:neo.txt:openFile:资源忙(文件被锁定)这是我的代码.
import Data.Char
import Prelude
import Data.List
import Text.Printf
import Data.Tuple
import Data.Ord
import Control.Monad
import Control.Applicative((<*))
import Text.Parsec
( Parsec, ParseError, parse -- Types and parser
, between, noneOf, sepBy, many1 -- Combinators
, char, spaces, digit, newline -- Simple parsers
)
Run Code Online (Sandbox Code Playgroud)
这些是电影领域.
type Title = String
type Director = String
type Year = Int
type UserRatings = (String,Int)
type Film = (Title, Director, Year , [UserRatings])
type Period = (Year, Year)
type Database = [Film]
Run Code Online (Sandbox Code Playgroud)
这是所有类型的解析,以便从文件中正确读取
-- …Run Code Online (Sandbox Code Playgroud)