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

git at git.haskell.org git at git.haskell.org
Tue Mar 20 11:54:12 UTC 2018


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

On branch  : wip/tdammers/D4394
Link       : http://ghc.haskell.org/trac/ghc/changeset/45d841eef492139d915ef8691be471f2f8556d42/ghc

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

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

    Fixes to Coercion.hs


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

45d841eef492139d915ef8691be471f2f8556d42
 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