-- | Perform an IO action, and place its result in a 'TMVar'. See-- also "Control.Concurrent.MVarIO" for an 'MVar' version.moduleControl.Concurrent.STM.TMVarIO(run)whereimportControl.ConcurrentimportControl.Concurrent.STM-- | @'run' action@ returns a 'TMVar' immediately. The result of-- @action@ will be placed in said 'TMVar'. If the 'TMVar' is full-- when @action@ completes, the return value is lost (i.e. we do not-- wait for an empty 'TMVar').run::IOa->IO(TMVara)runaction=newEmptyTMVarIO>>=\tm->forkIO(run'actiontm)>>returntmrun'::IOa->TMVara->IO()run'actiontm=action>>=\ret->atomically(tryPutTMVartmret)>>return()