[GHC] #11424: "Occurs check" not considered when reducing closed type families

GHC ghc-devs at haskell.org
Fri Jan 15 21:41:10 UTC 2016


#11424: "Occurs check" not considered when reducing closed type families
-------------------------------------+-------------------------------------
        Reporter:  diatchki          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      Resolution:                    |             Keywords:
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 diatchki):

 I am not sure what you mean by "abstract types".

 If by `x` you mean a type variable, then I don't think there is any
 problem in reducing `Equals x x` to `True`.

 Otoh, if you encountered `Equals (F a) (F a)`, then you can still reduce
 that to `True`, but you'd also have to emit the constraint `F a ~ b`, to
 make sure that `F a` is well-defined.

 I do agree that if we can't prove that a type family is total, it
 essentially should have a well-formedness check on every use---in this
 example this is `F a ~ b`, but one may have some other class/constraint
 encoding the same thing too.

 One may also think of this the other way: we always emit a well-formedness
 constraint on use, but if we've proved that a type function is total, then
 we can solve this constraint trivially.

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


More information about the ghc-tickets mailing list