checkExpr :: (?globals :: Globals)
          => Ctxt TypeScheme   -- context of top-level definitions
          -> Ctxt Assumption   -- local typing context
          -> Polarity         -- polarity of <= constraints
          -> Bool             -- whether we are top-level or not
          -> Type             -- type
          -> Expr () ()       -- expression
          -> Checker (Ctxt Assumption, Substitution, Expr () Type)

-- Hit an unfilled hole
checkExpr _ ctxt _ _ t (Hole s _) = do
  st <- get
  let varContext = relevantSubCtxt (concatMap (freeVars . snd) ctxt ++ (freeVars t)) (tyVarContext st)
  throw $ HoleMessage s (Just t) ctxt varContext

-- Checking of constants
checkExpr :: (?globals :: Globals)
          => Ctxt TypeScheme   -- context of top-level definitions
          -> Ctxt Assumption   -- local typing context
          -> Polarity         -- polarity of <= constraints
          -> Bool             -- whether we are top-level or not
          -> Type             -- type
          -> Expr () ()       -- expression
          -> Checker (Ctxt Assumption, Substitution, Expr () Type)
checkExpr _ ctxt _ _ t (Hole s _) = do
  st <- get
  let varContext = relevantSubCtxt (concatMap (freeVars . snd) ctxt ++ (freeVars t)) (tyVarContext st)
  throw $ HoleMessage s (Just t) ctxt varContext

-- Checking of constants
checkExpr _ ctxt _ _ t (Hole s _) = do
  st <- get
  let varContext = relevantSubCtxt (concatMap (freeVars . snd) ctxt ++ (freeVars t)) (tyVarContext st)
  throw $ HoleMessage s (Just t) ctxt varContext

-- Checking of constants