aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authordavve <davve@dtek.chalmers.se>2006-09-16 00:19:25 +0000
committerdavve <davve@dtek.chalmers.se>2006-09-16 00:19:25 +0000
commit06aaa77949c2c12b87e47baac85ef181a6930e17 (patch)
tree02003a5a5b907f1b9ccdfcd9e351afb512d53341 /src/Main.hs
parentd5b26fa7095b80adc5b9efc593ee4d6090896ad0 (diff)
Better comments in Main.hs
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs
index d8dfd55a..f3de2acd 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -711,8 +711,8 @@ renameModule renamingEnv mod =
docs = Map.toList (hmod_doc_map mod)
renameMapElem (k,d) = do d' <- renameDoc d; return (k, d')
- -- rename names in the exported declarations to point to things that
- -- are closer to, or maybe even exported by, the current module.
+ -- rename names in the exported declarations to point to things that
+ -- are closer to, or maybe even exported by, the current module.
(renamedExportItems, missingNames1)
= runRnFM localEnv (renameExportItems (hmod_export_items mod))
@@ -722,15 +722,18 @@ renameModule renamingEnv mod =
(finalModuleDoc, missingNames3)
= runRnFM localEnv (renameMaybeDoc (hmod_doc mod))
+ -- combine the missing names and filter out the built-ins, which would
+ -- otherwise allways be missing.
missingNames = nub $ filter isExternalName
(missingNames1 ++ missingNames2 ++ missingNames3)
- -- I haven't found the Name constant for () in the GHC API, so we have to
- -- filter out the "()" string instead
+ -- filter out the "()" string (I haven't found the Name constant for ()
+ -- in the GHC API)
strings = filter (/= "()") (map (showSDoc . ppr) missingNames)
in do
- -- report things that we couldn't link to. Only do this for non-hidden modules.
+ -- report things that we couldn't link to. Only do this for non-hidden
+ -- modules.
when (OptHide `notElem` hmod_options mod && not (null strings)) $
tell ["Warning: " ++ show (ppr (hmod_mod mod) defaultUserStyle) ++
": could not find link destinations for:\n"++
@@ -1094,14 +1097,18 @@ funTyConName = mkWiredInName gHC_PRIM
(ATyCon funTyCon) -- Relevant TyCon
BuiltInSyntax
+
toHsInstHead :: ([TyVar], [PredType], Class, [Type]) -> InstHead2 Name
toHsInstHead (_, preds, cls, ts) = (map toHsPred preds, className cls, map toHsType ts)
+
toHsPred :: PredType -> HsPred Name
toHsPred (ClassP cls ts) = HsClassP (className cls) (map toLHsType ts)
toHsPred (IParam n t) = HsIParam n (toLHsType t)
+
toLHsType = noLoc . toHsType
+
toHsType :: Type -> HsType Name
toHsType t = case t of
@@ -1121,6 +1128,7 @@ toHsType t = case t of
cvForAll vs t = mkExplicitHsForAllTy (tyvarbinders vs) (noLoc []) (toLHsType t)
tyvarbinders vs = map (noLoc . UserTyVar . tyVarName) vs
+
-- -----------------------------------------------------------------------------
-- A monad which collects error messages