X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fspecialise%2FSpecEnv.lhs;fp=ghc%2Fcompiler%2Fspecialise%2FSpecEnv.lhs;h=2d94809c97f674823422f85cbbbf4fd3056de094;hb=26741ec416bae2c502ef00a2ba0e79050a32cb67;hp=28b306de654568ccde6bd72fac07452c2098e20e;hpb=ae45ff0e9831a0dc862a5d68d03e355d7e323c62;p=ghc-hetmet.git diff --git a/ghc/compiler/specialise/SpecEnv.lhs b/ghc/compiler/specialise/SpecEnv.lhs index 28b306d..2d94809 100644 --- a/ghc/compiler/specialise/SpecEnv.lhs +++ b/ghc/compiler/specialise/SpecEnv.lhs @@ -7,7 +7,7 @@ #include "HsVersions.h" module SpecEnv ( - SpecEnv(..), MatchEnv, + SYN_IE(SpecEnv), MatchEnv, nullSpecEnv, isNullSpecEnv, addOneToSpecEnv, lookupSpecEnv, specEnvToList @@ -17,7 +17,7 @@ IMP_Ubiq() import MatchEnv import Type ( matchTys, isTyVarTy ) -import Usage ( UVar(..) ) +import Usage ( SYN_IE(UVar) ) \end{code} @@ -36,6 +36,22 @@ then \begin{verbatim} f (List Int) Bool d ===> f' Int Bool \end{verbatim} +All the stuff about how many dictionaries to discard, and what types +to apply the specialised function to, are handled by the fact that the +SpecEnv contains a template for the result of the specialisation. + +There is one more exciting case, which is dealt with in exactly the same +way. If the specialised value is unboxed then it is lifted at its +definition site and unlifted at its uses. For example: + + pi :: forall a. Num a => a + +might have a specialisation + + [Int#] ===> (case pi' of Lift pi# -> pi#) + +where pi' :: Lift Int# is the specialised version of pi. + \begin{code} nullSpecEnv :: SpecEnv