summaryrefslogtreecommitdiff
path: root/ghc/compiler/deSugar/DsCCall.lhs
diff options
context:
space:
mode:
authorsimonpj <unknown>2000-05-25 12:41:22 +0000
committersimonpj <unknown>2000-05-25 12:41:22 +0000
commit495ef8bd9ef30bffe50ea399b91e3ba09646b59a (patch)
treeb9ee4302d494d28a81879051d9d3e2a7693ec5e8 /ghc/compiler/deSugar/DsCCall.lhs
parentb5c71bff716366ae888bf120776d3e163c86c60a (diff)
downloadhaskell-495ef8bd9ef30bffe50ea399b91e3ba09646b59a.tar.gz
[project @ 2000-05-25 12:41:14 by simonpj]
~~~~~~~~~~~~ Apr/May 2000 ~~~~~~~~~~~~ This is a pretty big commit! It adds stuff I've been working on over the last month or so. DO NOT MERGE IT WITH 4.07! Interface file formats have changed a little; you'll need to make clean before remaking. Simon PJ Recompilation checking ~~~~~~~~~~~~~~~~~~~~~~ Substantial improvement in recompilation checking. The version management is now entirely internal to GHC. ghc-iface.lprl is dead! The trick is to generate the new interface file in two steps: - first convert Types etc to HsTypes etc, and thereby build a new ParsedIface - then compare against the parsed (but not renamed) version of the old interface file Doing this meant adding code to convert *to* HsSyn things, and to compare HsSyn things for equality. That is the main tedious bit. Another improvement is that we now track version info for fixities and rules, which was missing before. Interface file reading ~~~~~~~~~~~~~~~~~~~~~~ Make interface files reading more robust. * If the old interface file is unreadable, don't fail. [bug fix] * If the old interface file mentions interfaces that are unreadable, don't fail. [bug fix] * When we can't find the interface file, print the directories we are looking in. [feature] Type signatures ~~~~~~~~~~~~~~~ * New flag -ddump-types to print type signatures Type pruning ~~~~~~~~~~~~ When importing data T = T1 A | T2 B | T3 C it seems excessive to import the types A, B, C as well, unless the constructors T1, T2 etc are used. A,B,C might be more types, and importing them may mean reading more interfaces, and so on. So the idea is that the renamer will just import the decl data T unless one of the constructors is used. This turns out to be quite easy to implement. The downside is that we must make sure the constructors are always available if they are really needed, so I regard this as an experimental feature. Elimininate ThinAir names ~~~~~~~~~~~~~~~~~~~~~~~~~ Eliminate ThinAir.lhs and all its works. It was always a hack, and now the desugarer carries around an environment I think we can nuke ThinAir altogether. As part of this, I had to move all the Prelude RdrName defns from PrelInfo to PrelMods --- so I renamed PrelMods as PrelNames. I also had to move the builtinRules so that they are injected by the renamer (rather than appearing out of the blue in SimplCore). This is if anything simpler. Miscellaneous ~~~~~~~~~~~~~ * Tidy up the data types involved in Rules * Eliminate RnEnv.better_provenance; use Name.hasBetterProv instead * Add Unique.hasKey :: Uniquable a => a -> Unique -> Bool It's useful in a lot of places * Fix a bug in interface file parsing for __U[!]
Diffstat (limited to 'ghc/compiler/deSugar/DsCCall.lhs')
-rw-r--r--ghc/compiler/deSugar/DsCCall.lhs17
1 files changed, 9 insertions, 8 deletions
diff --git a/ghc/compiler/deSugar/DsCCall.lhs b/ghc/compiler/deSugar/DsCCall.lhs
index 11ca5a093a..6d488c44e7 100644
--- a/ghc/compiler/deSugar/DsCCall.lhs
+++ b/ghc/compiler/deSugar/DsCCall.lhs
@@ -28,7 +28,7 @@ import DataCon ( DataCon, splitProductType_maybe, dataConSourceArity, dataConWr
import CallConv
import Type ( isUnLiftedType, splitAlgTyConApp_maybe, mkFunTys,
splitTyConApp_maybe, tyVarsOfType, mkForAllTys,
- isNewType, repType, isUnLiftedType, mkFunTy,
+ isNewType, repType, isUnLiftedType, mkFunTy, mkTyConApp,
Type
)
import PprType ( {- instance Outputable Type -} )
@@ -36,14 +36,15 @@ import TysPrim ( byteArrayPrimTy, realWorldStatePrimTy,
byteArrayPrimTyCon, mutableByteArrayPrimTyCon, intPrimTy
)
import TysWiredIn ( unitDataConId, stringTy,
- unboxedPairDataCon,
- mkUnboxedTupleTy, unboxedTupleCon,
+ unboxedSingletonDataCon, unboxedPairDataCon,
+ unboxedSingletonTyCon, unboxedPairTyCon,
+ mkTupleTy, tupleCon,
boolTy, trueDataCon, falseDataCon, trueDataConId, falseDataConId,
unitTy
)
import Literal ( mkMachInt )
import CStrings ( CLabelString )
-import Unique ( Unique, Uniquable(..), ioTyConKey )
+import Unique ( Unique, Uniquable(..), hasKey, ioTyConKey )
import VarSet ( varSetElems )
import Outputable
\end{code}
@@ -212,7 +213,7 @@ boxResult result_ty
= case splitAlgTyConApp_maybe result_ty of
-- The result is IO t, so wrap the result in an IO constructor
- Just (io_tycon, [io_res_ty], [io_data_con]) | getUnique io_tycon == ioTyConKey
+ Just (io_tycon, [io_res_ty], [io_data_con]) | io_tycon `hasKey` ioTyConKey
-> mk_alt return_result
(resultWrapper io_res_ty) `thenDs` \ (ccall_res_ty, the_alt) ->
newSysLocalDs realWorldStatePrimTy `thenDs` \ state_id ->
@@ -247,8 +248,8 @@ boxResult result_ty
newSysLocalDs realWorldStatePrimTy `thenDs` \ state_id ->
let
the_rhs = return_result (Var state_id) (wrap_result (panic "boxResult"))
- ccall_res_ty = mkUnboxedTupleTy 1 [realWorldStatePrimTy]
- the_alt = (DataAlt (unboxedTupleCon 1), [state_id], the_rhs)
+ ccall_res_ty = mkTyConApp unboxedSingletonTyCon [realWorldStatePrimTy]
+ the_alt = (DataAlt unboxedSingletonDataCon, [state_id], the_rhs)
in
returnDs (ccall_res_ty, the_alt)
@@ -258,7 +259,7 @@ boxResult result_ty
newSysLocalDs prim_res_ty `thenDs` \ result_id ->
let
the_rhs = return_result (Var state_id) (wrap_result (Var result_id))
- ccall_res_ty = mkUnboxedTupleTy 2 [realWorldStatePrimTy, prim_res_ty]
+ ccall_res_ty = mkTyConApp unboxedPairTyCon [realWorldStatePrimTy, prim_res_ty]
the_alt = (DataAlt unboxedPairDataCon, [state_id, result_id], the_rhs)
in
returnDs (ccall_res_ty, the_alt)