Instance for `TVar`
This is a left-over issue from #6
As described in https://github.com/haskell/deepseq/issues/6#issuecomment-147619390 by @glguy defining an instance for TVar is complicated since we'd lose {-# LANGUAGE Safe #-} by import TVar which seems undesirable, given all other instances can be imported safely.
should the instance live in stm package instead? No safety problem then?
@phadej yeah, the only not-so-nice thing about that is that in stm it'd be an orphan
One option would be to add a Trustworthy module to define the rnf function and import it into Control.DeepSeq. But that seems pretty silly! The right answer is surely to add a safe TVar re-export somewhere in base.
The right answer is surely to add a safe
TVarre-export somewhere inbase.
That would be nice. But this needn't stop us from adding an NFData instance for TVar today, since there's a module Control.DeepSeq.BackDoor specifically for the purpose of safely re-exporting things from base that currently can't be imported safely. We'd likely have to perform some surgery on the CPP bounds to accommodate TVar, but it should be possible.
Yeah, this ticket predates the backdoor module by 1 year... so I mostly forgot about this... if anyone wants to take a stab at a PR...? :-)
Anyone?
Pull requests are welcome.