Replace `TVar` operations with IO counterparts

This replaces `readTVar` and `newTVar` with `readTVarIO` and
`newTVarIO`. According to the documentation:

> Return the current value stored in a TVar. This is equivalent to
>     readTVarIO = atomically . readTVar
> but works much faster, because it doesn't perform a complete
> transaction, it just reads the current value of the TVar.