import HsSyn ( HsDecl(..), IfaceSig(..) )
import TcMonad
import TcMonoType ( tcHsType, tcHsTypeKind, tcTyVarScope )
-import TcEnv ( tcExtendTyVarEnv, tcExtendGlobalValEnv,
+import TcEnv ( tcExtendTyVarEnv, tcExtendGlobalValEnv, tcSetGlobalValEnv,
tcLookupTyConByKey, tcLookupGlobalValueMaybe,
- tcExplicitLookupGlobal
+ tcExplicitLookupGlobal,
+ GlobalValueEnv
)
import TcKind ( TcKind, kindToTcKind )
-import RnHsSyn ( RenamedHsDecl(..) )
+import RnHsSyn ( RenamedHsDecl )
import HsCore
import HsDecls ( HsIdInfo(..), HsStrictnessInfo(..) )
import Literal ( Literal(..) )
import MagicUFs ( MagicUnfoldingFun )
import WwLib ( mkWrapper )
import PrimOp ( PrimOp(..) )
+import CallConv ( cCallConv )
import MkId ( mkImportedId, mkUserId )
import Id ( Id, addInlinePragma, isPrimitiveId_maybe, dataConArgTys )
signatures.
\begin{code}
-tcInterfaceSigs :: TcEnv s -- Envt to use when checking unfoldings
+tcInterfaceSigs :: GlobalValueEnv -- Envt to use when checking unfoldings
-> [RenamedHsDecl] -- Ignore non-sig-decls in these decls
-> TcM s [Id]
= tcStrictness unf_env ty info strict
tcPrag info (HsSpecialise tyvars tys rhs)
- = tcTyVarScope tyvars $ \ tyvars' ->
- mapTc tcHsType tys `thenTc` \ tys' ->
+ = tcTyVarScope tyvars $ \ tyvars' ->
+ mapAndUnzipTc tcHsTypeKind tys `thenTc` \ (kinds, tys') ->
+ -- Assume that the kinds match the kinds of the
+ -- type variables of the function; this is, after all, an
+ -- interface file generated by the compiler!
+
tcPragExpr unf_env name rhs `thenNF_Tc` \ maybe_rhs' ->
let
-- If spec_env isn't looked at, none of this
tcPragExpr unf_env name core_expr
= forkNF_Tc (
recoverNF_Tc no_unfolding (
- tcSetEnv unf_env $
+ tcSetGlobalValEnv unf_env $
tcCoreExpr core_expr `thenTc` \ core_expr' ->
returnTc (Just core_expr')
))
tcCoreNote (UfSCC cc) = returnTc (SCC cc)
tcCoreNote UfInlineCall = returnTc InlineCall
\end{code}
- returnTc (Note note' expr')
-
-tcCoreExpr (UfLam bndr body)
- = tcCoreLamBndr bndr $ \ bndr' ->
- tcCoreExpr body `thenTc` \ body' ->
- returnTc (Lam bndr' body')
-
-tcCoreExpr (UfLet (UfNonRec bndr rhs) body)
- = tcCoreExpr rhs `thenTc` \ rhs' ->
- tcCoreValBndr bndr $ \ bndr' ->
- tcCoreExpr body `thenTc` \ body' ->
- returnTc (Let (NonRec bndr' rhs') body')
-
-tcCoreExpr (UfLet (UfRec pairs) body)
- = tcCoreValBndrs bndrs $ \ bndrs' ->
- mapTc tcCoreExpr rhss `thenTc` \ rhss' ->
- tcCoreExpr body `thenTc` \ body' ->
- returnTc (Let (Rec (bndrs' `zip` rhss')) body')
- where
- (bndrs, rhss) = unzip pairs
-\end{code}
\begin{code}
tcCoreLamBndr (UfValBinder name ty) thing_inside
tcCorePrim (UfCCallOp str casm gc arg_tys res_ty)
= mapTc tcHsType arg_tys `thenTc` \ arg_tys' ->
tcHsType res_ty `thenTc` \ res_ty' ->
- returnTc (CCallOp str casm gc arg_tys' res_ty')
+ returnTc (CCallOp (Left str) casm gc cCallConv arg_tys' res_ty')
\end{code}
\begin{code}