+
+tcCoreExpr (UfNote note expr)
+ = tcCoreExpr expr `thenTc` \ expr' ->
+ case note of
+ UfCoerce to_ty -> tcHsTypeKind to_ty `thenTc` \ (_,to_ty') ->
+ returnTc (Note (Coerce to_ty' (coreExprType expr')) expr')
+ UfInlineCall -> returnTc (Note InlineCall expr')
+ UfSCC cc -> returnTc (Note (SCC cc) expr')
+
+tcCoreNote (UfSCC cc) = returnTc (SCC cc)
+tcCoreNote UfInlineCall = returnTc InlineCall
+
+
+-- rationalTy isn't built in so, we have to construct it
+-- (the "ty" part of the incoming literal is simply bottom)
+tcUfCon (UfLitCon (NoRepRational lit _))
+ = tcLookupTyConByKey rationalTyConKey `thenNF_Tc` \ rational_tycon ->
+ let
+ rational_ty = mkSynTy rational_tycon []
+ in
+ returnTc (Literal (NoRepRational lit rational_ty))
+
+-- Similarly for integers and strings, except that they are wired in
+tcUfCon (UfLitCon (NoRepInteger lit _))
+ = returnTc (Literal (NoRepInteger lit integerTy))
+tcUfCon (UfLitCon (NoRepStr lit _))
+ = returnTc (Literal (NoRepStr lit stringTy))
+
+tcUfCon (UfLitCon other_lit)
+ = returnTc (Literal other_lit)
+
+-- The dreaded lit-lits are also similar, except here the type
+-- is read in explicitly rather than being implicit
+tcUfCon (UfLitLitCon lit ty)
+ = tcHsType ty `thenTc` \ ty' ->
+ returnTc (Literal (MachLitLit lit ty'))
+
+tcUfCon (UfDataCon name) = tcUfDataCon name
+
+tcUfCon (UfPrimOp name)
+ = tcVar name `thenTc` \ op_id ->
+ case isPrimitiveId_maybe op_id of
+ Just op -> returnTc (PrimOp op)
+ Nothing -> failWithTc (badPrimOp name)
+
+tcUfCon (UfCCallOp str casm gc)
+ = returnTc (PrimOp (CCallOp (Left str) casm gc cCallConv))
+
+tcUfDataCon name
+ = tcVar name `thenTc` \ con_id ->
+ case isDataConId_maybe con_id of
+ Just con -> returnTc (DataCon con)
+ Nothing -> failWithTc (badCon name)