moduleAgda.TypeChecking.EmptywhereimportControl.ApplicativeimportAgda.Syntax.CommonimportAgda.Syntax.InternalimportAgda.TypeChecking.MonadimportAgda.TypeChecking.CoverageimportAgda.TypeChecking.ConstraintsimportAgda.TypeChecking.ReduceimportAgda.TypeChecking.SubstituteimportAgda.Utils.PermutationimportAgda.Utils.Size-- | Make sure that a type is empty.isReallyEmptyType::Type->TCM()isReallyEmptyTypet=noConstraints$isEmptyTypetisEmptyType::Type->TCM()isEmptyTypet=dotb<-reduceBtlett=ignoreBlockingtbcaseunEl<$>tbof-- if t is blocked or a meta, we cannot decide emptyness now. postponeNotBlockedMetaV{}->addConstraint(IsEmptyt)Blocked{}->addConstraint(IsEmptyt)_->do-- from the current context xs:ts, create a pattern list-- xs _ : ts t and try to split on _ (the last variable)tel0<-getContextTelescopeletgamma=telToListtel0++[defaultArg("_",t)]ps=[Arghr$VarPx|Arghr(x,_)<-gamma]tel=telFromListgammar<-splitInductivetel(idP$sizetel)ps0caserofLefterr->caseerrofCantSplitctelusvs_->traceCall(CheckIsEmptyt)$typeError$CoverageCantSplitOnctelusvs_->typeError$ShouldBeEmptyt[]Right[]->return()Rightcs->typeError$ShouldBeEmptyt$map(unArg.last.scPats)cs