[GHC] #9701: GADTs not specialized properly

GHC ghc-devs at haskell.org
Fri Oct 17 23:56:33 UTC 2014


#9701: GADTs not specialized properly
-------------------------------------+-------------------------------------
       Reporter:  dfeuer             |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.9
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:  Runtime
     Blocked By:                     |  performance bug
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 This has probably been raised before, but I can't find a ticket. If I
 write

 {{{#!hs
 data Silly a where
   Silly :: Ord a => a -> Silly a

 isItSilly :: a -> Silly a -> Bool
 isItSilly a (Silly x) = a < x

 isItSillyInt :: Int -> Silly Int -> Bool
 isItSillyInt = isItSilly
 }}}

 then I get

 {{{
 isItSilly
 isItSilly =
   \ @ a_aBq eta_B2 eta1_B1 ->
     case eta1_B1 of _ { Silly $dOrd_aBs x_aAy ->
     < $dOrd_aBs eta_B2 x_aAy
     }

 isItSillyInt
 isItSillyInt = isItSilly
 }}}

 Although GHC knows that `eta_B2` is an `Int`, and `x_aAy` therefore must
 be one as well, it looks up the `<` method in the `eta1_B1` dictionary
 instead of just using `ltInt`.

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


More information about the ghc-tickets mailing list