In the book, Simon Marlow explains that
data Async a = Async ThreadId (TMVar (Either SomeException a))
can not be made a functor, because (p. 202):
The type of the result that the
Async
will place in theTMVar
is fixed when we create theAsync
.
So he changes the definition to:
data Async a = Async ThreadId (STM (Either SomeException a))
Could someone elaborate on, or explain in other terms, why the first definition isn’t suitable?
Edit: I suppose it is because TMVar is surprisingly an instance of only Eq…