[Haskell-cafe] Is StateT what I need?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Dec 17 15:32:12 EST 2007

On Dec 17, 2007, at 14:33 , Andre Nathan wrote:

>> insertProc :: Pid -> StateT PsMap IO PsInfo
>> insertProc pid = do
>>   proc <- procInfo pid -- XXX this is obviously wrong...

   proc <- lift $ procInfo pid

>>   psMap <- get
>>   put (Map.insert pid proc psMap)

   modify (Map.insert pid proc) -- same as the above but cleaner

>>   return (proc)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list