Use unsafePerformIO from System.IO.Unsafe for GHC 7.8 compatibility

Deprecated `unsafePerformIO` export from `Foreign` is removed in base-4.7.0.0.