1. 17 Mar, 2020 1 commit
  2. 05 Dec, 2019 1 commit
    • Vladislav Zavialov's avatar
      Pretty-printing of the * kind · 3354c68e
      Vladislav Zavialov authored
      Before this patch, GHC always printed the * kind unparenthesized.
      
      This led to two issues:
      
      1. Sometimes GHC printed invalid or incorrect code.
         For example, GHC would print:  type F @*   x = x
               when it meant to print:  type F @(*) x = x
         In the former case, instead of a kind application we were getting a
         type operator (@*).
      
      2. Sometimes GHC printed kinds that were correct but hard to read.
         Should  Either * Int  be read as  Either (*) Int
                                    or as  (*) Either Int  ?
         This depends on whether -XStarIsType is enabled, but it would be
         easier if we didn't have to check for the flag when reading the code.
      
      We can solve both problems by assigning (*) a different precedence. Note
      that Haskell98 kinds are not affected:
      
        ((* -> *) -> *) -> *  does NOT become  (((*) -> (*)) -> (*)) -> (*)
      
      The parentheses are added when (*) is used in a function argument
      position:
      
         F * * *   becomes  F (*) (*) (*)
         F A * B   becomes  F A (*) B
         Proxy *   becomes  Proxy (*)
         a * -> *  becomes  a (*) -> *
      3354c68e
  3. 23 Jun, 2019 1 commit
    • Ryan Scott's avatar
      Refactor UnliftedNewtypes-relation kind signature validity checks · 9bbcc3be
      Ryan Scott authored
      This fixes three infelicities related to the programs that are
      (and aren't) accepted with `UnliftedNewtypes`:
      
      * Enabling `UnliftedNewtypes` would permit newtypes to have return
        kind `Id Type`, which had disastrous results (i.e., GHC panics).
      * Data family declarations ending in kind `TYPE r` (for some `r`)
        weren't being accepted if `UnliftedNewtypes` wasn't enabled,
        despite the GHC proposal specifying otherwise.
      * GHC wasn't warning about programs that _would_ typecheck if
        `UnliftedNewtypes` were enabled in certain common cases.
      
      As part of fixing these issues, I factored out the logic for checking
      all of the various properties about data type/data family return
      kinds into a single `checkDataKindSig` function. I also cleaned up
      some of the formatting in the existing error message that gets
      thrown.
      
      Fixes #16821, fixes #16827, and fixes #16829.
      9bbcc3be