[commit: ghc] master: Use the symmetric version of the newtype coercion. (da345e4)

Iavor Diatchki diatchki at galois.com
Fri May 31 19:08:10 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/da345e4c2cc32f299f8131dfff2bb6de6bca2ee1

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

commit da345e4c2cc32f299f8131dfff2bb6de6bca2ee1
Author: Iavor S. Diatchki <diatchki at galois.com>
Date:   Thu May 30 19:57:24 2013 -0700

    Use the symmetric version of the newtype coercion.

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

 compiler/prelude/PrelRules.lhs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs
index 50730e2..78ff3f0 100644
--- a/compiler/prelude/PrelRules.lhs
+++ b/compiler/prelude/PrelRules.lhs
@@ -47,7 +47,7 @@ import BasicTypes
 import DynFlags
 import Platform
 import Util
-import Coercion     (mkUnbranchedAxInstCo)
+import Coercion     (mkUnbranchedAxInstCo,mkSymCo)
 
 import Control.Monad
 import Data.Bits as Bits
@@ -994,12 +994,12 @@ match_inline _ = Nothing
 -- for a description of what is going on here.
 match_magicSingI :: [Expr CoreBndr] -> Maybe (Expr CoreBndr)
 match_magicSingI (Type t : e : Lam b _ : _)
-  | ([_,_,fu],_)     <- splitFunTys t
-  , (sI_type,_)      <- splitFunTy fu
-  , Just (sI_tc,xs)  <- splitTyConApp_maybe sI_type
-  , Just (_,_,co)    <- unwrapNewTyCon_maybe sI_tc
+  | ((_ : _ : fu : _),_)  <- splitFunTys t
+  , (sI_type,_)           <- splitFunTy fu
+  , Just (sI_tc,xs)       <- splitTyConApp_maybe sI_type
+  , Just (_,_,co)         <- unwrapNewTyCon_maybe sI_tc
   = Just $ let f = setVarType b fu
-           in Lam f $ Var f `App` Cast e (mkUnbranchedAxInstCo co xs)
+           in Lam f $ Var f `App` Cast e (mkSymCo (mkUnbranchedAxInstCo co xs))
 
 match_magicSingI _ = Nothing
 





More information about the ghc-commits mailing list