Skip to content
  • Simon Peyton Jones's avatar
    Refactor (~) to reduce the suerpclass stack · f265008f
    Simon Peyton Jones authored
    The constraint (~) used to be (effectively):
      class a ~~ b => (a :: k) ~ (b :: k)
    
    but, with this patch, it is now defined uniformly with
    (~~) and Coercible like this:
      class a ~# b => (a :: k) ~ (b :: k)
    
    Result:
      * One less superclass selection when goinng from (~) to (~#)
        Better for compile time and better for debugging with -ddump-simpl
    
      * The code for (~), (~~), and Coercible looks uniform, and appears
        together, e.g. in TysWiredIn and ClsInst.matchGlobalInst.
        Previously the code for (~) was different, and unique.
    
    Not only is this simpler, but it also makes the compiler a bit faster;
      T12227: 9% less allocation
      T12545: 7% less allocation
    
    This patch fixes Trac #15421
    f265008f