
24 Aug
2007
24 Aug
'07
10:56 a.m.
Adrian Neumann wrote:
Now I'd like to get a new StdGen, in case no id was supplied to the script.
parse :: Maybe String-> IO StdGen parse (Just x) = return $ read x parse Nothing = getStdGen
Obviously this doesn't work because I'm trying to do IO inside CGI (right?). Is there some incantation I can perform to make this possible?
Abracadabra, the incantation is liftIO :: IO a -> CGI a i.e. parse :: Maybe String-> CGI StdGen parse (Just x) = return $ read x parse Nothing = liftIO getStdGen Regards, apfelmus