为什么这个函数有类型:
deleteAllMp4sExcluding :: [Char] -> IO (IO ())
而不是deleteAllMp4sExcluding :: [Char] -> IO ()
另外,我怎样才能重写它以便它有一个更简单的定义?
这是函数定义:
import System.FilePath.Glob
import qualified Data.String.Utils as S
deleteAllMp4sExcluding videoFileName =
let dirGlob = globDir [compile "*"] "."
f = filter (\s -> S.endswith ".mp4" s && (/=) videoFileName s) . head . fst
lst = f <$> dirGlob
in mapM_ removeFile <$> lst