[GHC] #2110: Rules to eliminate casted id's

GHC ghc-devs at haskell.org
Tue Feb 11 13:45:56 UTC 2014


#2110: Rules to eliminate casted id's
-------------------------------------+------------------------------------
        Reporter:  igloo             |            Owner:
            Type:  feature request   |           Status:  patch
        Priority:  lowest            |        Milestone:  7.10.1
       Component:  Compiler          |          Version:  6.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by nomeata):

 I changed the definition of `coerce` back to the naive one, and aimed at
 making the rule matcher smarter. I did this by adding a function
 `exprIsLambda_maybe` which is used when a rule template contains a lambda.

 Previously, the code would either use a Lambda, if its there, or eta-
 expand both sides otherwise. The latter seemed to be somewhat dangerous
 (could waste work, although I could not produce a example for that due to
 later CSE and other effects), and did not help in the case discussed here.

 So instead I try to „make the expression“ into a lambda. Either it already
 is a lambda, or it is a (nested) application of something that has a
 currently active unfolding which is unsaturated: In that case, unfold it,
 `simpleOptExpr` and recursively look for further lambdas. Any any cast
 occurring while doing so will be pushed inside the lambda.

 With that change, matching `unsafeCoerce` works as well!

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2110#comment:45>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list