[commit: ghc] wip/tdammers/D4394: Fixes to Coercion.hs (4fa4034)

git at git.haskell.org git at git.haskell.org
Thu Mar 22 11:02:32 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/tdammers/D4394
Link       : http://ghc.haskell.org/trac/ghc/changeset/4fa4034bdf1b7ef1444602bef6499e14ab5b58b9/ghc

>---------------------------------------------------------------

commit 4fa4034bdf1b7ef1444602bef6499e14ab5b58b9
Author: Tobias Dammers <tdammers at gmail.com>
Date:   Mon Mar 5 11:20:34 2018 +0100

    Fixes to Coercion.hs


>---------------------------------------------------------------

4fa4034bdf1b7ef1444602bef6499e14ab5b58b9
 compiler/types/Coercion.hs | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs
index a1368de..af3cb2c 100644
--- a/compiler/types/Coercion.hs
+++ b/compiler/types/Coercion.hs
@@ -815,16 +815,17 @@ mkTransCo co1 co2       = TransCo co1 co2
 mkNthCo :: HasDebugCallStack
         => Role  -- the role of the coercion you're creating
         -> Int
-				-> Coercion
-				-> Coercion
+        -> Coercion
+        -> Coercion
 mkNthCo r n co
   = ASSERT(good_call)
     go r n co
   where
-		(ty1, ty2) = coercionKind co
+    Pair ty1 ty2 = coercionKind co
+
     good_call
-		  -- If the Coercion passed in is between forall-types, then the Int must
-		  -- be 0 and the role must be Nominal.
+      -- If the Coercion passed in is between forall-types, then the Int must
+      -- be 0 and the role must be Nominal.
       | Just (tv1, _) <- splitForAllTy_maybe ty1
       , Just (tv2, _) <- splitForAllTy_maybe ty2
       = n == 0 && r == Nominal
@@ -841,8 +842,8 @@ mkNthCo r n co
       -- See also Note [NthCo Cached Roles] if you're wondering why it's
       -- blaringly obvious that we should be *computing* this role instead of
       -- passing it in.
-      | Just (tc1, tys1) <- splitTyConnApp_maybe ty1
-      , Just (tc2, tys1) <- splitForAllTy_maybe ty2
+      | Just (tc1, tys1) <- splitTyConApp_maybe ty1
+      , Just (tc2, tys2) <- splitTyConApp_maybe ty2
       , tc1 == tc2
       = let len1 = length tys1
             len2 = length tys2
@@ -853,7 +854,7 @@ mkNthCo r n co
         in len1 == len2 && n < len1 && good_role
 
       | otherwise
-			= True
+      = True
 
     go r 0 (Refl _ ty)
       | Just (tv, _) <- splitForAllTy_maybe ty
@@ -905,7 +906,7 @@ mkNthCo r n co
                                                             , ppr r ]) )
                                              arg_cos `getNth` n
 
-    mkNthCo r n co =
+    go r n co =
       NthCo r n co
 
 -- | If you're about to call @mkNthCo r n co@, then @r@ should be



More information about the ghc-commits mailing list