From 5aeae7aaf9f831a97a55eea61f553795f23a2d1b Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 16 Jul 2009 12:26:01 +0000 Subject: [PATCH] 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. --- compiler/iface/MkIface.lhs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 -- 1.7.10.4