[Haskell-cafe] Re: MonadPrompt + Gtk2Hs = ?

Ryan Ingram ryani.spam at gmail.com
Mon Jan 14 23:08:15 EST 2008


On Jan 14, 2008 2:28 PM, Felipe Lessa <felipe.lessa at gmail.com> wrote:
> > 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


More information about the Haskell-Cafe mailing list