【发布时间】:2011-05-01 07:00:33
【问题描述】:
我阅读了有关该软件包的文档和一些文章,但我是 Haskell 的新手,不太了解,但我尝试了....
以下是我所做的:
module Main where
{-# LANGUAGE BangPatterns #-}
import Control.Parallel(par,pseq)
import Control.Exception
import Data.List
import IO
import Data.Char
import Criterion.Main (defaultMain, bench)
learquivo :: FilePath -> IO ([[Int]])
learquivo "mkList1.txt" = do
conteudo <- readFile "mkList1.txt"
return (read conteudo)
main = defaultMain [
bench "map sort learquivo" $ \n -> map sort learquivo
]
因为它发生了以下错误:
Couldn't match expected type [[a]]
against inferred type FilePath -> IO [[Int]]
【问题讨论】:
-
两件事:如果您可以提供
mapa和psort函数,会更容易提供帮助,并且根据 GHC 文档,pragma 必须在module行之前。 -
Travis Brown,谢谢,我做了很多测试,忘了修复它。