
On Jan 14, 2008 2:28 PM, Felipe Lessa
lastAttempt' :: AttemptCode lastAttempt' showInfo entry button = guessGameNew >>= contPromptM done cont where cont :: forall a. GuessP a -> (a -> IO ()) -> IO () -- signature needed cont (Print s) c = showInfo s >> c () cont Guess c = do mfix $ \cid -> onClicked button $ do {signalDisconnect cid; guess <- entryGetText entry; c (read guess)} return () done attempts = showInfo $ "You took " ++ show attempts ++ " attempts."
Excellent work; I love it. I'll definitely have to give this a try when I get back from vacation. I'd been wondering what the best way to interface with GUI code is and it's nice to have a sample to work from. -- ryan