Missed beta reductions

Simon Peyton Jones simonpj at microsoft.com
Tue Mar 27 07:55:02 UTC 2018


Yes, it’s possible that he sequence you are seeing is what is happening to you.  But why is that not what you want to see?  What are you trying to achieve?

Since this function might be applied to many different arguments, it’s probably not a good idea to do anything unconditionally…

S

From: David Feuer <david at well-typed.com>
Sent: 27 March 2018 01:04
To: Simon Peyton Jones <simonpj at microsoft.com>; ghc-devs at haskell.org
Subject: RE: Missed beta reductions

Hmmm. So you think maybe it's doing something like (roughly; I don't have the exact case in front of me)

(\p q -> f p (g p q)) this that

==> beta reduce

let
  p = this
  q = that
in f p (g p q)

==> inline q

let
  p = this
in f p (g p that)
?

I tried marking the "this" in question INLINE CONLIKE [0]. Shouldn't that tell GHC that duplicating it is fine? I really want to see it for RULES.


David Feuer
Well-Typed, LLP

-------- Original message --------
From: Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>>
Date: 3/26/18 7:14 PM (GMT-05:00)
To: David Feuer <david at well-typed.com<mailto:david at well-typed.com>>, ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
Subject: RE: Missed beta reductions

GHC always beta-reduces.

It does not always inline.   For that: -ddump-inlinings

Simon

From: ghc-devs <ghc-devs-bounces at haskell.org<mailto:ghc-devs-bounces at haskell.org>> On Behalf Of David Feuer
Sent: 26 March 2018 23:59
To: ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
Subject: Missed beta reductions

What's the best way to find spots where GHC saw a redex and choose not to beta reduce? Is there a flag for that? It could be useful when trying to figure out why rules aren't firing.


David Feuer
Well-Typed, LLP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180327/9e023b33/attachment.html>


More information about the ghc-devs mailing list