Conflict with Network.CGI and System.Random

Hello all, I'm trying to write a program to be converted into a cgi file using Network.CGI and Text.Xhtml, and I want to have random numbers in it. Sounds simple, but I need to call the global random generator (I think) and I can't do that in the CGI block, i.e. cgiTMain = do gen <- getStdGen ... simply doesn't work, nor an variation of calling a function in the cgiTMainblock with a type of IO(), which is what I need to get the generator. Is it impossible both to write a program using Network.CGI and have random values? That seems very limiting, the people that wrote Haskell were smarter than that... Thanks, Will

CGI m a is an instance of MonadIO if m is, so import Control.Monad.Trans cgiTMain = do gen <- liftIO getStdGen ... should work.
participants (2)
-
Alexander Solla
-
william murphy