ku-fpg / hermit

Haskell Equational Reasoning Model-to-Implementation Tunnel
http://www.ittc.ku.edu/csdl/fpg/Tools/HERMIT
BSD 2-Clause "Simplified" License
49 stars 8 forks source link

Build proper inlinings for class selector methods #159

Closed xich closed 8 years ago

xich commented 8 years ago

Motivated by #157

Given the strategy outlined in:

https://github.com/ghc/ghc/blob/2db18b8135335da2da9918b722699df684097be9/compiler/typecheck/TcInstDcls.hs#L158

Class methods don't have unfoldings defined, relying instead of BuiltInRules for inlining. BuiltInRules are functions, so we can't reify them and use them in HERMIT. However, we have access to all the same information that is used to build the BuiltInRule in the mg_inst_env, so we should be able to build an inlining from that and use it in inlineR.

For the code which builds the rule, see:

https://github.com/ghc/ghc/blob/f3cc34568b13abb29de7b54a5f657681e9e116ca/compiler/basicTypes/MkId.hs#L307