
2 Feb
2007
2 Feb
'07
3:28 p.m.
On 2/2/07, Chad Scherrer
So in reality, I'm trying to construct something like f :: (a -> STM b) -> STM (a -> b)
I just figured it was a general monadic kind of problem, more simply expressed using lists. But the (!!) solution doesn't make sense in this context.
Perhaps this will work for you: f x = join . liftM f This typechecks, and seems to work as expected, e.g.: Prelude Control.Concurrent.STM Control.Monad> atomically (f readTVar (newTVar 'a')) 'a' /g -- It is myself I have never met, whose face is pasted on the underside of my mind.