tycon saturation and type equality (Type.tcEqType)

Simon Peyton-Jones simonpj at microsoft.com
Tue Mar 8 16:11:21 CET 2011


Yes; see the invariant on AppTy in TypeRep.lhs.  The first argument of an AppTy is never a TyConApp.  We are always careful to call Type.mkAppTy to maintain this invariant.  The equality check doesn't need to do the normalisation; it's done on construction.

Simon

|  -----Original Message-----
|  From: cvs-ghc-bounces at haskell.org [mailto:cvs-ghc-bounces at haskell.org] On Behalf
|  Of Adam Megacz
|  Sent: 07 March 2011 12:10
|  To: cvs-ghc at haskell.org
|  Subject: tycon saturation and type equality (Type.tcEqType)
|  
|  
|  Type constructor applications need not be saturated.  Therefore, both of
|  these are legitimate values of type Type:
|  
|     AppTy (TyConApp []) X
|     TyConApp [X]
|  
|  However, it seems like none of GHC's type-comparison functions
|  (tcEqType, coreEqType, various permutations of
|  coreView/expandTypeSynonyms etc) treat these types as equal.
|  
|  Is there some sort of further normalization operation which ought to be
|  applied to a pair of Types before comparing them?  Or have I missed
|  something more fundamental here?
|  
|  Thanks,
|  
|    - a
|  
|  
|  _______________________________________________
|  Cvs-ghc mailing list
|  Cvs-ghc at haskell.org
|  http://www.haskell.org/mailman/listinfo/cvs-ghc




More information about the Cvs-ghc mailing list