[Haskell-beginners] apt cabal hackage

Daniel Fischer daniel.is.fischer at googlemail.com
Thu Sep 22 20:43:07 CEST 2011


On Thursday 22 September 2011, 20:18:53, csmagic wrote:
> Now I find that I am directed to do at page
> http://trac.sivity.net/language_c/wiki/GettingStarted
> 
> module Main where
> import Language.C
> import Language.C.System.GCC   -- preprocessor used
> main = parseMyFile "test.c" >>= printMyAST
> 
> Whats with the double import?
> Does not the contents of Language.C get imported when that is imported?

Only if Language.C.System.GCC re-exports Language.C.

By default, nothing (except instance of type classes) imported from another 
module is re-exported, so if you want to use things from both, you have to 
import both (thus you have more fine-grained control of what is in scope in 
your module).

If you want to re-export things from an imported module (because using your 
module wouldn't be convenient without some stuff defined elsewhere), you 
have to include what you want to re-export in the export list of your 
module,

module Mine (module Imported.Module, local, stuff) where

re-exports the entire imported module, to re-export only certain entities, 
list them individually.



More information about the Beginners mailing list