[GHC] #11715: Constraint vs *

GHC ghc-devs at haskell.org
Fri Aug 19 12:50:02 UTC 2016


#11715: Constraint vs *
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:                    |             Keywords:  Typeable
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by int-index):

 Yes, a `with` error is not a viable solution. Since we'd like to treat
 anything to the LHS of `=>` the same way, issuing an error would break
 this example:

 {{{
 data SomeOrd a where
   SomeOrd :: Ord a => a -> SomeOrd a

 cmp :: SomeOrd a -> SomeOrd a -> Ordering
 cmp (SomeOrd a) (SomeOrd b) =
   -- Do we use an 'Ord a' dictionary from the first argument
   -- or the second argument? We know it's the same dictionary
   -- because class instances are coherent, but this might be
   -- not the case for values provided by `with`.
   compare a b
 }}}

 By the way, how does GHC currently decide which dictionary to use in the
 example above?

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


More information about the ghc-tickets mailing list