Module imports anywhere

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Oct 22 10:17:59 EDT 2006


Hello Henning,

Sunday, October 22, 2006, 5:48:11 PM, you wrote:

> I don't see the benefit of allowing imports anywhere at top-level.

it is useful to move together imports and related code. say:

#if HUGS
import Hugs.Base
addInt = hugsAddInt
#elseif GHC
import GHC.Base
addInt = ghcAddInt
#endif

currently we are forced to make separate sections for import and use:

#if HUGS
import Hugs.Base
#elseif GHC
import GHC.Base
#endif

#if HUGS
addInt = hugsAddInt
#elseif GHC
addInt = ghcAddInt
#endif


just another example:

-- higher-level stuff:

openFile = ...

-- medium-level-stuff

createFD = ..

-- low-level stuff

import System,FD

_create = ... System.FD.create



(i don't propose subj. i just know pros and contras for it)


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-prime mailing list