Re: [GHC] #14046: “Illegal type synonym family application in instance” is too strict in the presence of functional dependencies

GHC ghc-devs at haskell.org
Fri Jul 28 07:18:05 UTC 2017


#14046: “Illegal type synonym family application in instance” is too strict in the
presence of functional dependencies
-------------------------------------+-------------------------------------
        Reporter:  lexi.lambda       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #3485             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * cc: Iceland_jack (removed)


Comment:

 Consider
 {{{
 (A)     instance (b ~ [c]) => C Int b
 vs
 (B)     instance C Int [c]
 }}}
 These behave quite differently.  (B) waits until the constraint to be
 solved looks like `C Int [something]` and then uses the instance.

 But (A) waits only until the constraint looks like `C Int something` and
 then fires the instance, generating a constraint `something ~ [c0]` where
 `c0` is a fresh unification variable.

 So for example `C Int t0`, where `t0` is a unification variable` will be
 solved by (A) but not by (B).

 It's similar with type families.  I think you should write it in the (A)
 form if you want that behaviour.

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


More information about the ghc-tickets mailing list