View patterns, record wildcards, and record puns
[ghc-hetmet.git] / compiler / iface / MkIface.lhs
index 0d200d8..407f3ea 100644 (file)
@@ -4,6 +4,13 @@
 %
 
 \begin{code}
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+
 module MkIface ( 
        mkUsageInfo,    -- Construct the usage info for a module
 
@@ -258,7 +265,7 @@ mkIface hsc_env maybe_old_iface
 --     put exactly the info into the TypeEnv that we want
 --     to expose in the interface
 
-  = do { eps <- hscEPS hsc_env
+  = do {eps <- hscEPS hsc_env
        ; let   { entities = typeEnvElts type_env ;
                   decls  = [ tyThingToIfaceDecl entity
                           | entity <- entities,
@@ -270,8 +277,8 @@ mkIface hsc_env maybe_old_iface
                             nameIsLocalOrFrom this_mod name  ]
                                -- Sigh: see Note [Root-main Id] in TcRnDriver
 
-               ; fixities    = [(occ,fix) | FixItem occ fix _ <- nameEnvElts fix_env]
-               ; deprecs     = mkIfaceDeprec src_deprecs
+               ; fixities    = [(occ,fix) | FixItem occ fix <- nameEnvElts fix_env]
+               ; deprecs     = src_deprecs
                ; iface_rules = map (coreRuleToIfaceRule this_mod) rules
                ; iface_insts = map instanceToIfaceInst insts
                ; iface_fam_insts = map famInstToIfaceFamInst fam_insts
@@ -312,7 +319,7 @@ mkIface hsc_env maybe_old_iface
                        mi_fix_fn = mkIfaceFixCache fixities }
 
                -- Add version information
-                ; ext_ver_fn = mkParentVerFun hsc_env eps
+              ; ext_ver_fn = mkParentVerFun hsc_env eps
                ; (new_iface, no_change_at_all, pp_diffs, pp_orphs) 
                        = {-# SCC "versioninfo" #-}
                         addVersionInfo ext_ver_fn maybe_old_iface
@@ -684,12 +691,6 @@ mkOrphMap get_key decls
        | otherwise = (non_orphs, d:orphs)
 
 ----------------------
-mkIfaceDeprec :: Deprecations -> IfaceDeprecs
-mkIfaceDeprec NoDeprecs        = NoDeprecs
-mkIfaceDeprec (DeprecAll t)    = DeprecAll t
-mkIfaceDeprec (DeprecSome env) = DeprecSome (sortLe (<=) (nameEnvElts env))
-
-----------------------
 bump_unless :: Bool -> Version -> Version
 bump_unless True  v = v        -- True <=> no change
 bump_unless False v = bumpVersion v
@@ -840,7 +841,8 @@ mkIfaceExports exports
                -- Usually just one, but see Note [Original module]
 
        add_for_mod env mod
-           = add_one env mod (AvailTC tc_occ names_from_mod)
+           = add_one env mod (AvailTC tc_occ (sort names_from_mod))
+              -- NB. sort the children, we need a canonical order
            where
              names_from_mod = [nameOccName n | n <- ns, nameModule n == mod]
 \end{code}
@@ -1218,7 +1220,7 @@ tyThingToIfaceDecl (ATyCon tycon)
                    ifConUnivTvs = toIfaceTvBndrs (dataConUnivTyVars data_con),
                    ifConExTvs   = toIfaceTvBndrs (dataConExTyVars data_con),
                    ifConEqSpec  = to_eq_spec (dataConEqSpec data_con),
-                   ifConCtxt    = toIfaceContext (dataConTheta data_con),
+                   ifConCtxt    = toIfaceContext (dataConEqTheta data_con ++ dataConDictTheta data_con),
                    ifConArgTys  = map toIfaceType (dataConOrigArgTys data_con),
                    ifConFields  = map getOccName 
                                       (dataConFieldLabels data_con),
@@ -1327,7 +1329,7 @@ toIfaceIdInfo id_info
 
     ------------  Worker  --------------
     work_info   = workerInfo id_info
-    has_worker  = case work_info of { HasWorker _ _ -> True; other -> False }
+    has_worker  = workerExists work_info
     wrkr_hsinfo = case work_info of
                    HasWorker work_id wrap_arity -> 
                        Just (HsWorker ((idName work_id)) wrap_arity)