Difference between revisions of "Talk:Import"

From HaskellWiki
Jump to navigation Jump to search
(Using import on same module multiple times.)
 
(added code tag)
Line 1: Line 1:
 
Recently on Haskell-Cafe, the topic of imports came up. I noticed this page does not detail the ability to import the same module multiple times under different conditions. Here's an example:
 
Recently on Haskell-Cafe, the topic of imports came up. I noticed this page does not detail the ability to import the same module multiple times under different conditions. Here's an example:
   
  +
<haskell>
> module Main where
+
module Main where
>
 
  +
> import qualified Prelude as P
 
> import Prelude ((++),show,($))
+
import qualified Prelude as P
  +
import Prelude ((++),show,($))
>
 
  +
> main = P.putStrLn (show $ P.length $ [1] ++ [2,3])
+
main = P.putStrLn (show $ P.length $ [1] ++ [2,3])
  +
</haskell>
   
 
I'm not sure if this is exclusive to GHC, or whether it's H98. If it's the latter, then it should probably be on this page. If it's the former, it may still be good to have here.
 
I'm not sure if this is exclusive to GHC, or whether it's H98. If it's the latter, then it should probably be on this page. If it's the former, it may still be good to have here.

Revision as of 13:37, 16 September 2008

Recently on Haskell-Cafe, the topic of imports came up. I noticed this page does not detail the ability to import the same module multiple times under different conditions. Here's an example:

module Main where
 
import qualified Prelude as P
import Prelude ((++),show,($))
 
main = P.putStrLn (show $ P.length $ [1] ++ [2,3])

I'm not sure if this is exclusive to GHC, or whether it's H98. If it's the latter, then it should probably be on this page. If it's the former, it may still be good to have here.