在我的調試器ex中,haskell指向dropWhile中間的一個奇怪錯誤: 解析錯誤輸入'=' 加載模塊失敗。Haskell編譯錯誤
代碼:
identifyFilter :: String -> (Filter, String)
identifyFilter ('"':xs) | not null rest = (filter, rest1)
| otherwise = error "Invalid input"
where (field, rest) = break (=='"') xs
(cond, rest1) = break (=='"') (tail (dropWhile (/= '"') (tail rest)))
filter = (FieldName field , identifyParsers cond)
identifyFilter ('@':xs) | not null rest = (filter, rest1)
| otherwise = error "Invalid input"
where (index, rest)(reads xs) :: [(Int,String)]
(cond, rest1) = break (=='"') (tail (dropWhile (/= '"') (tail rest)))
filter = (FieldIndex index , identifyParsers cond)
identifyFilter (x:xs) = error "Invalid input"
我有沒有可能什麼線索可能是一個特別引起錯誤時,它指向到一個字的中間。 如果需要更多,請詢問。 任何建議將有助於
GHCi接受我的線(用'let'代替'where')。問題可能在其他地方。 – ibid
一個簡短但完整的代碼示例在編譯時會產生精確的錯誤,這很好。 – sepp2k
是否有任何前面/後面的行在'dropWhile'中間的上方/下方有一個'='?如果是這樣,他們是什麼? – dave4420