[GHC] #10225: GHC does not specialize based on type equality

GHC ghc-devs at haskell.org
Wed Apr 1 07:49:32 UTC 2015


#10225: GHC does not specialize based on type equality
-------------------------------------+-------------------------------------
              Reporter:  yongqli     |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  normal      |           Version:  7.10.1
             Component:  Compiler    |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  None/Unknown
          Architecture:              |        Blocked By:
  Unknown/Multiple                   |   Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Based on my testing, it seems that if I have a function like

 f :: (v ~ V2) => v -> v

 this will be slower than

 f :: v -> v

 It would be great if GHC could do this optimization. The reason I want
 this is that I have written some very generic functions in my program,
 which are actually only used for one type. SPECIALIZE doesn't seem to do
 enough, as it's hard to get those GHC to "see" all of those types. As a
 compromise, I tried to tell GHC what those types actually are via type
 equalities, so that I can keep type constraints around for the future.

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


More information about the ghc-tickets mailing list