checkDataCons :: (?globals :: Globals) => DataDecl -> Checker ()
checkDataCons (DataDecl sp name tyVars k dataConstrs) = do
    st <- get
    let kind = case lookup name (typeConstructors st) of
                Just (kind,_,_) -> kind
                Nothing -> error $ "Internal error. Trying to lookup data constructor " <> pretty name
    modify' $ \st -> st { tyVarContext = [(v, (k, ForallQ)) | (v, k) <- tyVars] }
    mapM_ (checkDataCon name kind tyVars) dataConstrs
checkDataCons :: (?globals :: Globals) => DataDecl -> Checker ()
checkDataCons (DataDecl sp name tyVars k dataConstrs) = do
    st <- get
    let kind = case lookup name (typeConstructors st) of
                Just (kind,_,_) -> kind
                Nothing -> error $ "Internal error. Trying to lookup data constructor " <> pretty name
    modify' $ \st -> st { tyVarContext = [(v, (k, ForallQ)) | (v, k) <- tyVars] }
    mapM_ (checkDataCon name kind tyVars) dataConstrs
checkDataCons (DataDecl sp name tyVars k dataConstrs) = do
    st <- get
    let kind = case lookup name (typeConstructors st) of
                Just (kind,_,_) -> kind
                Nothing -> error $ "Internal error. Trying to lookup data constructor " <> pretty name
    modify' $ \st -> st { tyVarContext = [(v, (k, ForallQ)) | (v, k) <- tyVars] }
    mapM_ (checkDataCon name kind tyVars) dataConstrs