26
According to a number of tutorials (including Real World Haskell) one can, using ghci do the following
ghci > :m Text.Regex.Posix
ghci > "foo foo foo" =~ "foo" :: [String]
["foo","foo","foo"]
Yet, when I attempt this, it yields
No instance for (RegexContext Regex [Char] [String])
arising from a use of `=~'
Possible fix:
add an instance declaration for
(RegexContext Regex [Char] [String])
In the expression: "abc" =~ "ab" :: [String]
In an equation for `it': it = "abc" =~ "ab" :: [String]
What is the correct way of obtaining a list of all matches in haskell?