summaryrefslogtreecommitdiff
path: root/compiler/simplCore
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2006-12-06 07:18:45 +0000
committersimonpj@microsoft.com <unknown>2006-12-06 07:18:45 +0000
commit94cbe022cbe18c2ae8da829d39c0896d615f8f1c (patch)
tree1c6fd5cb3303f1e0f189ceab930a938c8440b034 /compiler/simplCore
parentb55fe864599e77f2ae2a3fbeec899ea7aeeac9f2 (diff)
downloadhaskell-94cbe022cbe18c2ae8da829d39c0896d615f8f1c.tar.gz
Improve dependency analysis; makes more dictionaries inlinable
I recentl changed the scoring system used by dependency analysis for recursive bindings, that it used the *form* of the RHS of a binding, rather than just its type. In doing so I inadvertently made recursive dictionary bindings unravel less well, because I'd missed the case of c = /\a. C (...) (...) This patch fixes the problem. A good example is the instance for Monad (ST s) or Show (ST s a) in GHC.ST. It's vital for these dictionaries to be inlinable.
Diffstat (limited to 'compiler/simplCore')
-rw-r--r--compiler/simplCore/OccurAnal.lhs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/simplCore/OccurAnal.lhs b/compiler/simplCore/OccurAnal.lhs
index 8b3d45e8e0..fc9104fb22 100644
--- a/compiler/simplCore/OccurAnal.lhs
+++ b/compiler/simplCore/OccurAnal.lhs
@@ -328,8 +328,13 @@ reOrderCycle bndrs (bind : binds)
-- But we won't because constructor args are marked "Many".
-- Cheap and cheerful; the simplifer moves casts out of the way
+ -- The lambda case is important to spot x = /\a. C (f a)
+ -- which comes up when C is a dictionary constructor and
+ -- f is a default method.
+ -- Example: the instance for Show (ST s a) in GHC.ST
is_con_app (Var v) = isDataConWorkId v
is_con_app (App f _) = is_con_app f
+ is_con_app (Lam b e) | isTyVar b = is_con_app e
is_con_app (Note _ e) = is_con_app e
is_con_app other = False