Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
haskell错误-输入上的分析错误'=';_Haskell - Fatal编程技术网

haskell错误-输入上的分析错误'=';

haskell错误-输入上的分析错误'=';,haskell,Haskell,我正在编译这段代码,并收到“parse error on input'=”的错误` import System.IO import Data.List.Split main = do handle <- openFile "ac/abc" ReadMode contents <- hGetContents handle let xs = splitOneOf "; \n " contents print xs read

我正在编译这段代码,并收到“parse error on input'=”的错误`

import System.IO  
import Data.List.Split
main = do  
   handle <- openFile "ac/abc" ReadMode  
   contents <- hGetContents handle  
   let xs = splitOneOf "; \n " contents       
   print xs   
   readStrList contents = do 
       print contents
   hClose handle
import System.IO
导入Data.List.Split
main=do

处理问题在于以下几行:

readStrList contents = do 
    print contents
如果您试图定义
readStrList
,则需要将
let
放在前面:

let readStrList contents = do
        print contents

你想用
readStrList
行完成什么?实际上我在尝试另一种递归方式,因为forM_uuu需要hoogle。这是有效的。谢谢,但这个定义没有任何作用,因为
contents
会隐藏外部
内容,并且该函数永远不会被调用。(并不是说你错了,只是我不知道这条线想做什么,但可能不是这样。)@Chuck:我假设它是打算稍后在
do
块中使用的。但我同意,很难判断这里的意图。