[commit: ghc] master: Allow newtypes to be promoted (b8739b2)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b8739b28f5bc855b7c5406425b516698cf3b2f0d

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

commit b8739b28f5bc855b7c5406425b516698cf3b2f0d
Author: Simon Peyton Jones <[email protected]>
Date:   Fri Dec 21 08:05:58 2012 +0000

    Allow newtypes to be promoted
    
    Fixes Trac #7488

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

 compiler/basicTypes/DataCon.lhs |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler/basicTypes/DataCon.lhs b/compiler/basicTypes/DataCon.lhs
index 1b14179..7a58a7b 100644
--- a/compiler/basicTypes/DataCon.lhs
+++ b/compiler/basicTypes/DataCon.lhs
@@ -1035,8 +1035,9 @@ isPromotableType _                 = False
 -- If tc's kind is [ *^n -> * ] returns [ Just n ], else returns [ Nothing ]
 isPromotableTyCon :: TyCon -> Maybe Int
 isPromotableTyCon tc
-  | isDataTyCon tc  -- Only *data* types can be promoted, not newtypes
-    		    -- not synonyms, not type families
+  | isDataTyCon tc || isNewTyCon tc
+       -- Only *data* and *newtype* types can be promoted, 
+       -- not synonyms, not type/data families
   , all isLiftedTypeKind (res:args) = Just $ length args
   | otherwise                       = Nothing
   where
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.