
On Sun, Apr 04, 2010 at 09:25:16PM -0400, MH wrote:
I am running the following code that is using Selenium. If you look at the function "start", you will see that the return type of the function is polymorphic. Now in main function, I call start function to get selenium IO monad and sequentially call selenium commands (open, doCommand etc...). The problem that I have here is, while I can call all Selenium commands with signature (String -> Selenium String), I can't call commands with signature (String -> Selenium Bool). As I understand it, even though "start" function shall return IO (Selenium a -> IO (Either String a)), it actually return IO (Selenium String -> IO (Either String String)).
Hmm, I must confess that I don't understand exactly what is going on here. One thing to try is to give an explicit type annotation at start's call site, something like
main = do (selenium :: Selenium a -> IO (Either String a)) <- start "http://www.google.com" selenium $ open "/" selenium $ doCommand SWindowMaximize [] selenium $ typeText (Name "q") "stuff" selenium $ clickAndWait (Name "btnG") return selenium
Does that help? -Brent