I’m trying to translate my java program into Haskell. My goal is to split my string into several string and place these within a list.
This is my code so far
import Char
import IO
import Text.Regex
translate :: String -> Int
translate input =
testcode(splitRegex (mkRegex "\\s") input)
testcode does some tests depending on what the first value is, like for example(made this on the fly not gotten this far yet)
testcode :: [String] -> Int -> Int
testcode [] 0
testcode (x:xs) n
|(x=="test") = 1
|otherwise = testcode xs
My compile error that I keep getting is the following:
Could not find module `Text.Regex'
Perhaps you meant Text.Read (from base)
How do I import Text.Regex?
Text.Regexis in theregex-compatPackage. Did you install it?Cabal is the package manager for haskell: http://www.haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package
To install the regex package, enter the following an a shell:
To find out to which package a function belongs, I use Hayoo!, which is a search engine for the haskell package repository Hackage.