summaryrefslogtreecommitdiff
path: root/compiler/iface/BinIface.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-01-25 12:48:06 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2013-01-25 12:48:06 +0000
commit09ff0e0da88272fa4a8f117bbc90cea9e444ab5d (patch)
tree039d283034b2689b8447cbb831ff8ac13891cd88 /compiler/iface/BinIface.hs
parent35f1fc957d152c520c90c6bd2330266e57578eb2 (diff)
downloadhaskell-09ff0e0da88272fa4a8f117bbc90cea9e444ab5d.tar.gz
Refactor and improve the promotion inference
It should be the case that either an entire mutually recursive group of data type declarations can be promoted, or none of them. It's really odd to promote some data constructors of a type but not others. Eg data T a = T1 a | T2 Int Here T1 is sort-of-promotable but T2 isn't (becuase Int isn't promotable). This patch makes it all-or-nothing. At the same time I've made the TyCon point to its promoted cousin (via the tcPromoted field of an AlgTyCon), as well as vice versa (via the ty_con field of PromotedTyCon). The inference for the group is done in TcTyDecls, the same place that infers which data types are recursive, another global question.
Diffstat (limited to 'compiler/iface/BinIface.hs')
-rw-r--r--compiler/iface/BinIface.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs
index cf9402a74e..f39c21f0d2 100644
--- a/compiler/iface/BinIface.hs
+++ b/compiler/iface/BinIface.hs
@@ -1326,7 +1326,7 @@ instance Binary IfaceDecl where
put_ _ (IfaceForeign _ _) =
error "Binary.put_(IfaceDecl): IfaceForeign"
- put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8) = do
+ put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do
putByte bh 2
put_ bh (occNameFS a1)
put_ bh a2
@@ -1336,6 +1336,7 @@ instance Binary IfaceDecl where
put_ bh a6
put_ bh a7
put_ bh a8
+ put_ bh a9
put_ bh (IfaceSyn a1 a2 a3 a4) = do
putByte bh 3
@@ -1378,8 +1379,9 @@ instance Binary IfaceDecl where
a6 <- get bh
a7 <- get bh
a8 <- get bh
+ a9 <- get bh
occ <- return $! mkOccNameFS tcName a1
- return (IfaceData occ a2 a3 a4 a5 a6 a7 a8)
+ return (IfaceData occ a2 a3 a4 a5 a6 a7 a8 a9)
3 -> do a1 <- get bh
a2 <- get bh
a3 <- get bh