Comment #7 on issue 276 by Will.Donnelly: HConf should be a standalone
package
http://code.google.com/p/yi-editor/issues/detail?id=276
The conditional imports in HConf.hs are a little confusing (indented for
readability):
#ifndef mingw32_HOST_OS
#ifdef darwin_HOST_OS
import System.Posix.Process (getProcessStatus, forkProcess,
exitImmediately,
ProcessStatus(..))
import qualified System.Posix.Process as SPP (executeFile)
import System.Posix.Signals (raiseSignal, sigTSTP)
#else
import System.Posix.Process (executeFile)
#endif
import Control.OldException (handle)
#endif
Firstly, while I understand that 'handle' is only used when the host OS
isn't mingw,
is there any reason it couldn't be imported with the other primitives from
'Control.OldException'? It would make the imports much more readable and
straightforward.
Secondly, the executeFile import stuff is a little confusing. For
readability, I
would suggest it always be imported qualified, and then add an else to the
compilation of the 'executeFile' function, so on non-darwin platforms it's
just
'executeFile = SPP.executeFile'
Finally, mingw is for *Windows*, and darwin most certainly isn't that.
Isn't it
redundant to have the darwin conditional inside the mingw one?
Basically I'm asking, could those imports be simplified to this:
-- We have to write a custom executeFile for Darwin support,
-- so we import the function qualified here.
#ifndef mingw32_HOST_OS
import qualified System.Posix.Process as SPP (executeFile)
#endif
-- These will be needed on Darwin for the custom executeFile function
#ifdef darwin_HOST_OS
import System.Posix.Process (getProcessStatus, forkProcess,
exitImmediately,
ProcessStatus(..))
import System.Posix.Signals (raiseSignal, sigTSTP)
#endif
import Control.OldException (catch, bracket, handle)
Without breaking anything majorly?
Attached is a diff of the changes I made, and the new HConf.hs. I added
more explicit
statements of what functions and variables are imported, and reorganized
the import
ordering slightly for aesthetic reasons.
Attachments:
imports.diff 2.3 KB
HConf.hs 14.4 KB
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
Yi development mailing list
[email protected]
http://groups.google.com/group/yi-devel
-~----------~----~----~----~------~----~------~--~---