summaryrefslogtreecommitdiff
path: root/ghc/compiler/cprAnalysis
diff options
context:
space:
mode:
authorkeithw <unknown>1999-07-15 14:08:50 +0000
committerkeithw <unknown>1999-07-15 14:08:50 +0000
commit9d787ef5a8072b6c1f576f2de1b66edfa59813ed (patch)
tree21041d32d5a973988ed1c8f34d89c0afc5e0ad2b /ghc/compiler/cprAnalysis
parent5c60f4ca21334fa8b6324423b70ae044e5ad5bf9 (diff)
downloadhaskell-9d787ef5a8072b6c1f576f2de1b66edfa59813ed.tar.gz
[project @ 1999-07-15 14:08:03 by keithw]
This commit makes a start at implementing polymorphic usage annotations. * The module Type has now been split into TypeRep, containing the representation Type(..) and other information for `friends' only, and Type, providing the public interface to Type. Due to a bug in the interface-file slurping prior to ghc-4.04, {-# SOURCE #-} dependencies must unfortunately still refer to TypeRep even though they are not friends. * Unfoldings in interface files now print as __U instead of __u. UpdateInfo now prints as __UA instead of __U. * A new sort of variables, UVar, in their own namespace, uvName, has been introduced for usage variables. * Usage binders __fuall uv have been introduced. Usage annotations are now __u - ty (used once), __u ! ty (used possibly many times), __u uv ty (used uv times), where uv is a UVar. __o and __m have gone. All this still lives only in a TyNote, *for now* (but not for much longer). * Variance calculation for TyCons has moved from typecheck/TcTyClsDecls to types/Variance. * Usage annotation and inference are now done together in a single pass. Provision has been made for inferring polymorphic usage annotations (with __fuall) but this has not yet been implemented. Watch this space!
Diffstat (limited to 'ghc/compiler/cprAnalysis')
-rw-r--r--ghc/compiler/cprAnalysis/CprAnalyse.lhs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ghc/compiler/cprAnalysis/CprAnalyse.lhs b/ghc/compiler/cprAnalysis/CprAnalyse.lhs
index 7cf43ca97c..6ad58cd05f 100644
--- a/ghc/compiler/cprAnalysis/CprAnalyse.lhs
+++ b/ghc/compiler/cprAnalysis/CprAnalyse.lhs
@@ -15,7 +15,7 @@ import Var ( Var, Id, TyVar, idType, varName, varType )
import Id ( setIdCprInfo, getIdCprInfo, getIdUnfolding )
import IdInfo ( CprInfo(..) )
import VarEnv
-import Type ( Type(..), splitFunTys, splitForAllTys, splitNewType_maybe )
+import Type ( Type, splitFunTys, splitForAllTys, splitNewType_maybe )
import TyCon ( isProductTyCon, isNewTyCon, isUnLiftedTyCon )
import DataCon ( dataConTyCon, splitProductType_maybe )
import Const ( Con(DataCon), isWHNFCon )
@@ -365,8 +365,9 @@ splitTypeToFunArgAndRes ty = (tyvars, argtys, resty)
(argtys, resty) = splitFunTysIgnoringNewTypes funty
-- (argtys, resty) = splitFunTys funty
--- Taken from splitFunTys in Type.lhs. Modified to keep searching through newtypes
+-- splitFunTys, modified to keep searching through newtypes.
-- Should move to Type.lhs if it is doing something sensible.
+
splitFunTysIgnoringNewTypes :: Type -> ([Type], Type)
splitFunTysIgnoringNewTypes ty = split ty
where
@@ -378,6 +379,7 @@ splitFunTysIgnoringNewTypes ty = split ty
where
(args, res) = splitFunTys ty
+
-- Is this the constructor for a product type (i.e. algebraic, single constructor)
-- NB: isProductTyCon replies 'False' for unboxed tuples
isConProdType :: Con -> Bool