- check_con con = msum (foldDataConArgs ft_check con)
-
- ft_check :: FFoldType (Maybe SDoc)
- ft_check = FT { ft_triv = Nothing, ft_var = Nothing, ft_co_var = Just covariant
- , ft_fun = \x y -> if allowFunctions then x `mplus` y else Just functions
- , ft_tup = \_ xs -> msum xs
- , ft_ty_app = \_ x -> x
- , ft_bad_app = Just wrong_arg
- , ft_forall = \_ x -> x }
+ check_con con = msum (check_vanilla con : foldDataConArgs (ft_check con) con)
+
+ check_vanilla :: DataCon -> Maybe SDoc
+ check_vanilla con | isVanillaDataCon con = Nothing
+ | otherwise = Just (badCon con existential)
+
+ ft_check :: DataCon -> FFoldType (Maybe SDoc)
+ ft_check con = FT { ft_triv = Nothing, ft_var = Nothing
+ , ft_co_var = Just (badCon con covariant)
+ , ft_fun = \x y -> if allowFunctions then x `mplus` y
+ else Just (badCon con functions)
+ , ft_tup = \_ xs -> msum xs
+ , ft_ty_app = \_ x -> x
+ , ft_bad_app = Just (badCon con wrong_arg)
+ , ft_forall = \_ x -> x }