Hi everyone,

I looking for a way to analyze Haskell source to determine which module each imported symbol comes from. My goal is to transform source code like this:

    import Data.List
    ...
    main = do
      nums <- fmap (map read . words) getLine :: IO [Int]
      print $ sort nums

to code like this:

    import qualified Prelude as B
    import qualified Data.List as A
    ...
    main = do
      nums <- B.fmap (B.map B.read B.. B.words) B.getLine :: B.IO [B.Int]
      B.print B.$ A.sort nums

That is, I want to qualify all imported symbols with a module alias.

Can anyone suggest modules or programs I should look at?

Thanks,
ER