[Git][ghc/ghc][wip/T21623] Wibbles in RepType

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Tue Aug 16 11:23:54 UTC 2022



Simon Peyton Jones pushed to branch wip/T21623 at Glasgow Haskell Compiler / GHC


Commits:
c878a5a5 by Simon Peyton Jones at 2022-08-16T12:25:18+01:00
Wibbles in RepType

- - - - -


3 changed files:

- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Tc/Solver/Canonical.hs
- compiler/GHC/Types/RepType.hs


Changes:

=====================================
compiler/GHC/Core/TyCo/Rep.hs
=====================================
@@ -1396,14 +1396,14 @@ SelTyCon, SelForAll, and SelFun.
 * SelTyCon:
 
       co : (T s1..sn) ~r0 (T t1..tn)
-      T is a data type not a newtype
+      T is a data type, not a newtype, nor an arrow type
       r = tyConRole tc r0 i
       i < n    (i is zero-indexed)
       ----------------------------------
       SelCo r (SelTyCon i) : si ~r ti
 
-  See Note [SelCo and newtypes]
-
+  "Not a newtype": see Note [SelCo and newtypes]
+  "Not an arrow type": see SelFun below
 
 * SelForAll:
       co : forall (a:k1).t1 ~r0 forall (a:k2).t2


=====================================
compiler/GHC/Tc/Solver/Canonical.hs
=====================================
@@ -961,9 +961,10 @@ canEqNC ev eq_rel ty1 ty2
            Right ty              -> canEqReflexive ev eq_rel ty
            Left (Pair ty1' ty2') -> can_eq_nc False ev' eq_rel ty1' ty1' ty2' ty2'
              where
-               ev' | debugIsOn = setCtEvPredType ev $
-                                 mkPrimEqPredRole (eqRelRole eq_rel) ty1' ty2'
-                   | otherwise = ev
+                 ev' = ev
+--               ev' | debugIsOn = setCtEvPredType ev $
+--                                 mkPrimEqPredRole (eqRelRole eq_rel) ty1' ty2'
+--                   | otherwise = ev
                    -- ev': satisfy the precondition of can_eq_nc
        }
 


=====================================
compiler/GHC/Types/RepType.hs
=====================================
@@ -31,7 +31,6 @@ import GHC.Prelude
 
 import GHC.Types.Basic (Arity, RepArity)
 import GHC.Core.DataCon
-import GHC.Builtin.Names
 import GHC.Core.Coercion
 import GHC.Core.TyCon
 import GHC.Core.TyCon.RecWalk
@@ -56,7 +55,6 @@ import {-# SOURCE #-} GHC.Builtin.Types ( anyTypeOfKind
 import GHC.Utils.Misc
 import GHC.Utils.Outputable
 import GHC.Utils.Panic
-import GHC.Utils.Panic.Plain
 
 import Data.List (sort)
 import qualified Data.IntSet as IS
@@ -589,19 +587,16 @@ kindPrimRep doc ki
 -- NB: We could implement the partial methods by calling into the maybe
 -- variants here. But then both would need to pass around the doc argument.
 
--- | Take a kind (of shape @TYPE rr@) and produce the 'PrimRep's
+-- | Take a kind (of shape `TYPE rr` or `CONSTRAINT rr`) and produce the 'PrimRep's
 -- of values of types of this kind.
 -- See also Note [Getting from RuntimeRep to PrimRep]
 -- Returns Nothing if rep can't be determined. Eg. levity polymorphic types.
 kindPrimRep_maybe :: HasDebugCallStack => Kind -> Maybe [PrimRep]
 kindPrimRep_maybe ki
-  | Just ki' <- coreView ki
-  = kindPrimRep_maybe ki'
-kindPrimRep_maybe (TyConApp typ [runtime_rep])
-  = assert (typ `hasKey` tYPETyConKey) $
-    runtimeRepPrimRep_maybe runtime_rep
-kindPrimRep_maybe _ki
-  = Nothing
+  | Just (_torc, rep) <- sORTKind_maybe ki
+  = runtimeRepPrimRep_maybe rep
+  | otherwise
+  = pprPanic "kindPrimRep" (ppr ki)
 
 -- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that
 -- it encodes. See also Note [Getting from RuntimeRep to PrimRep]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c878a5a5621c48ae2735cee856d339b69ff61cd1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c878a5a5621c48ae2735cee856d339b69ff61cd1
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220816/dcedc225/attachment-0001.html>


More information about the ghc-commits mailing list