- -- Stuff for an *algebraic* data type
- alg_tycon_app_maybe = splitAlgTyConApp_maybe first_inst_tau
- -- The "Alg" part looks through synonyms
- Just (alg_tycon, _, _) = alg_tycon_app_maybe
-
-ccallable_type ty = isFFIArgumentTy False {- Not safe call -} ty
-creturnable_type ty = isFFIResultTy ty
+ ccallable_type dflags ty = isFFIArgumentTy dflags False {- Not safe call -} ty
+ creturnable_type ty = isFFIImportResultTy dflags ty
+
+check_tyvars dflags clas inst_taus
+ -- Check that at least one isn't a type variable
+ -- unless -fallow-undecideable-instances
+ | dopt Opt_AllowUndecidableInstances dflags = []
+ | not (all isTyVarTy inst_taus) = []
+ | otherwise = [the_err]
+ where
+ the_err = instTypeErr clas inst_taus msg
+ msg = ptext SLIT("There must be at least one non-type-variable in the instance head")
+
+check_fundeps dflags theta clas inst_taus
+ | checkInstFDs theta clas inst_taus = []
+ | otherwise = [the_err]
+ where
+ the_err = instTypeErr clas inst_taus msg
+ msg = ptext SLIT("the instance types do not agree with the functional dependencies of the class")