import FieldLabel ( FieldLabel, fieldLabelName, fieldLabelType )
import Id ( idType, dataConFieldLabels, dataConSig, recordSelectorFieldLabel,
isRecordSelector,
- Id, GenId
+ Id
)
import Kind ( Kind, mkBoxedTypeKind, mkTypeKind, mkArrowKind )
import Name ( Name{-instance Eq-} )
thenMClassOpKey, zeroClassOpKey, returnMClassOpKey
)
import Outputable
-import PprType ( GenType, GenTyVar ) -- Instances
import Maybes ( maybeToBool )
import ListSetOps ( minusList )
import Util
-- tcPolyExpr is like tcExpr, except that the expected type
-- can be a polymorphic one.
+tcPolyExpr :: SDoc -- Just for error messages
+ -> RenamedHsExpr
+ -> TcType s -- Expected type
+ -> TcM s (TcExpr s, LIE s) -- Resulting type and LIE
+
tcPolyExpr str arg expected_arg_ty
| not (maybeToBool (splitForAllTy_maybe expected_arg_ty))
= -- The ordinary, non-rank-2 polymorphic case
-- Conclusion: include the free vars of the expected arg type in the
-- list of "free vars" for the signature check.
- tcAddErrCtxt (rank2ArgCtxt arg expected_arg_ty) $
tcExtendGlobalTyVars (tyVarSetToList (tyVarsOfType expected_arg_ty)) $
checkSigTyVars sig_tyvars sig_tau `thenTc` \ zonked_sig_tyvars ->
- newDicts Rank2Origin sig_theta `thenNF_Tc` \ (sig_dicts, dict_ids) ->
+ newDicts SignatureOrigin sig_theta `thenNF_Tc` \ (sig_dicts, dict_ids) ->
-- ToDo: better origin
tcSimplifyAndCheck
HsLet (MonoBind inst_binds [] Recursive)
arg'
, free_insts
- )
+ )
\end{code}
%************************************************************************