[Haskell-cafe] Mechanize in Haskell or Revive Shpider?

Cody Goodman codygman.consulting at gmail.com
Thu Nov 13 22:14:25 UTC 2014

What would be a good way to model mechanize in Haskell? For instance
the python mechanize example is quite simple:

def google_search(keyword):
    br = mechanize.Browser()
    br["q"] = keyword
    response = br.submit()
    print html_to_text(response.read())

I was thinking I could just use a StateT monad transformer with the
current pages html as a cursor. Then have something like:

get "http://www.google.com" >>=
(\c -> c $// form (Name "gbqf") >=> input (Name "q") &|
submit . modifyVal "query" "Haskell")

That's kinda horrible but it's a place to start. Or would I be better
off trying to revive Shpider?

More information about the Haskell-Cafe mailing list