summaryrefslogtreecommitdiff
path: root/compiler/main/TidyPgm.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/TidyPgm.hs')
-rw-r--r--compiler/main/TidyPgm.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs
index 8f2e3342f2..6bbd55611a 100644
--- a/compiler/main/TidyPgm.hs
+++ b/compiler/main/TidyPgm.hs
@@ -58,6 +58,7 @@ import ErrUtils (Severity(..))
import Outputable
import SrcLoc
import qualified ErrUtils as Err
+import TcType ( isOverloadedTy )
import Control.Monad
import Data.Function
@@ -726,6 +727,7 @@ addExternal expose_all id = (new_needed_ids, show_unfold)
never_active = isNeverActive (inlinePragmaActivation (inlinePragInfo idinfo))
loop_breaker = isStrongLoopBreaker (occInfo idinfo)
bottoming_fn = isBottomingSig (strictnessInfo idinfo)
+ is_overloaded = isOverloadedTy (idType id)
-- Stuff to do with the Id's unfolding
-- We leave the unfolding there even if there is a worker
@@ -737,11 +739,14 @@ addExternal expose_all id = (new_needed_ids, show_unfold)
|| isStableSource src -- Always expose things whose
-- source is an inline rule
-
|| not (bottoming_fn -- No need to inline bottom functions
|| never_active -- Or ones that say not to
|| loop_breaker -- Or that are loop breakers
|| neverUnfoldGuidance guidance)
+ || (if is_overloaded
+ then pprTrace "ADDITIONAL UNFOLDING:" (ppr id) True
+ else False) -- Always expose overloaded things so that
+ -- they can be specialised at call sites.
show_unfolding (DFunUnfolding {}) = True
show_unfolding _ = False