From: Simon Marlow Date: Thu, 16 Jul 2009 12:26:01 +0000 (+0000) Subject: Use a stable ordering for the export list in the interface X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=5aeae7aaf9f831a97a55eea61f553795f23a2d1b Use a stable ordering for the export list in the interface The export list was ordered according to the whim of FastStrings, which meant that interface fingerprints could change for no good reason, causing spurious recompilation. --- diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index c929d96..17a379b 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -923,11 +923,14 @@ mkIfaceAnnotation (Annotation { ann_target = target, ann_value = serialized }) = \begin{code} mkIfaceExports :: [AvailInfo] -> [(Module, [GenAvailInfo OccName])] - -- Group by module and sort by occurrence - -- This keeps the list in canonical order + -- Group by module and sort by occurrence mkIfaceExports exports = [ (mod, eltsFM avails) - | (mod, avails) <- fmToList groupFM + | (mod, avails) <- sortBy (stableModuleCmp `on` fst) (fmToList groupFM) + -- NB. the fmToList is in a random order, + -- because Ord Module is not a predictable + -- ordering. Hence we perform a final sort + -- using the stable Module ordering. ] where -- Group by the module where the exported entities are defined