我将尝试将我的Java程序翻译成Haskell,我的目标是将字符串分割成几个字符串并将这些字符串放入一个列表中。
以下是我迄今为止的代码:
我经常遇到的编译错误如下:
以下是我迄今为止的代码:
import Char
import IO
import Text.Regex
translate :: String -> Int
translate input =
testcode(splitRegex (mkRegex "\\s") input)
testcode根据第一个值的不同进行一些测试,例如(这是即兴编写的,并未实际执行)
testcode :: [String] -> Int -> Int
testcode [] 0
testcode (x:xs) n
|(x=="test") = 1
|otherwise = testcode xs
我经常遇到的编译错误如下:
Could not find module `Text.Regex'
Perhaps you meant Text.Read (from base)
我该如何导入Text.Regex模块?
words
。 - hammar