In doubt this code compiles with GHC 7.0 even after fixing this, but still, in this code:
#if __GLASGOW_HASKELL__ >= 700
import Control.Exception (mask_)
#else
import qualified Control.Exception
mask_ = Control.Exception.block
#endif
import Control.Exception (try, IOException)
For GHC < 7.0 this defines a top-level value and then imports another module, which is not allowed. Value definitions should come after all imports.
As a fix I'd suggest dropping support for GHC 7.0 as it's probably not used these days (it was released in 2010).
In doubt this code compiles with GHC 7.0 even after fixing this, but still, in this code:
For GHC < 7.0 this defines a top-level value and then imports another module, which is not allowed. Value definitions should come after all imports.
As a fix I'd suggest dropping support for GHC 7.0 as it's probably not used these days (it was released in 2010).