Enable Safe Haskell extension

This introduces an additional dependency on the [`stm`](http://hackage.haskell.org/package/stm) package. Alternatively one could add a cabal flag  to enable the extension (and the [`stm`](http://hackage.haskell.org/package/stm) dependency).