[Haskell-beginners] Regex woes...
Sean Charles
sean at objitsu.com
Sat Jun 11 00:15:43 CEST 2011
I did a cabal update then:
cabal install regex-base
cabal install regex-compat
cabal install regex-posix
Everything built and installed, there were no errors as far as I could
tell. However, on attempting to get into regex on page 199 of my Real
World Haskell book I get this error when trying to use [String] as the
return type and I don't know why...
GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :m Text.Regex.Posix
Prelude Text.Regex.Posix>
Prelude Text.Regex.Posix> "this is the string" =~ "th" :: [String]
<interactive>:1:0:
No instance for (RegexContext Regex [Char] [String])
arising from a use of `=~' at <interactive>:1:0-27
Possible fix:
add an instance declaration for
(RegexContext Regex [Char] [String])
In the expression: "this is the string" =~ "th" :: [String]
In the definition of `it':
it = "this is the string" =~ "th" :: [String]
Prelude Text.Regex.Posix>
I am trying to write a page scraper, I've already sucked pages with
Network.HTTP and I thought it'd be easy to get the anchor tags!
More information about the Beginners
mailing list