[GHC] #14321: -fsolve-constant-dicts is not very robust when dealing with GADTs

GHC ghc-devs at haskell.org
Wed Oct 4 18:44:28 UTC 2017


#14321: -fsolve-constant-dicts is not very robust when dealing with GADTs
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #9701
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I expected `-fsolve-constant-dicts` to nail #9701, it didn't fire at all
 but a slightly modified version does.

 {{{
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE TypeApplications #-}
 module Foo where

 data Silly a where
   Silly :: Ord a => a -> Silly a

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

 isItSillyIntTA :: Int -> Silly Int -> Bool
 isItSillyIntTA = isItSilly @Int

 isItSillyInt :: Int -> Silly Int  -> Bool
 isItSillyInt  a x = isItSilly a x

 isItSillyInt2 :: Int -> Silly Int -> Bool
 isItSillyInt2 a (Silly x) = a < x

 isItSillyInt3 :: Int -> Silly Int -> Bool
 isItSillyInt3 a (Silly x) = isItSilly a (Silly x)
 }}}

 Both versions 2 and 3 specialise nicely using the `Int` `Ord` dictionary.
 The first two versions don't. I'm unsure whether it *should* fire or not
 but I am making this ticket to record this fact.

 Clonable code and core dump -
 https://gist.github.com/mpickering/f84a5f842861211e8e731c63e82d5c01

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


More information about the ghc-tickets mailing list