[Haskell-cafe] Re: Is StateT what I need?
ChrisK
haskell at list.mightyreason.com
Mon Dec 17 15:06:52 EST 2007
Andre Nathan wrote:
> Hello (Newbie question ahead :
>
> I tried this for insertProc, but it obviously doesn't work... what would
> be the correct way to do this?
>
>> insertProc :: Pid -> StateT PsMap IO PsInfo
>> insertProc pid = do
>> proc <- procInfo pid -- XXX this is obviously wrong...
>> psMap <- get
>> put (Map.insert pid proc psMap)
>> return (proc)
>
I see that using "lift" makes it compile (Control.Monad.Trans.lift):
> insertProc pid = do
> proc <- lift (procInfo pid)
More information about the Haskell-Cafe
mailing list