{-# LANGUAGE CPP #-}moduleAgda.TypeChecking.Errors(prettyError,PrettyTCM(..),tcErrString)whereimportControl.Applicative((<$>))importControl.Monad.StateimportControl.Monad.ErrorimportqualifiedData.MapasMap(empty)importSystem.FilePathimportAgda.Syntax.CommonimportAgda.Syntax.FixityimportAgda.Syntax.PositionimportqualifiedAgda.Syntax.InfoasAimportqualifiedAgda.Syntax.ConcreteasCimportqualifiedAgda.Syntax.Concrete.DefinitionsasDimportAgda.Syntax.AbstractasAimportAgda.Syntax.InternalasIimportqualifiedAgda.Syntax.Abstract.PrettyasPimportqualifiedAgda.Syntax.Concrete.PrettyasPimportAgda.Syntax.Translation.InternalToAbstractimportAgda.Syntax.Translation.AbstractToConcreteimportAgda.Syntax.Scope.Base(ScopeInfo(..))importAgda.TypeChecking.MonadimportAgda.TypeChecking.PrettyimportAgda.Utils.FileNameimportAgda.Utils.MonadimportAgda.Utils.Size#include "../undefined.h"importAgda.Utils.Impossible----------------------------------------------------------------------------- * Top level function---------------------------------------------------------------------------prettyError::TCErr->TCMStringprettyErrorerr=liftTCM$liftMshow$prettyTCMerr`catchError`\err'->text"panic: error when printing error!"$$prettyTCMerr'`catchError`\err''->text"much panic: error when printing error from printing error!"$$prettyTCMerr''`catchError`\err'''->fsep(pwords"total panic: error when printing error from printing error from printing error."++pwords"I give up! Approximations of errors:")$$vcat(map(text.tcErrString)[err,err',err'',err'''])----------------------------------------------------------------------------- * Helpers---------------------------------------------------------------------------sayWhere::HasRangea=>a->TCMDoc->TCMDocsayWherexd=text(show$getRangex)$$dsayWhen::Range->Maybe(ClosureCall)->TCMDoc->TCMDocsayWhenrNothingm=sayWherermsayWhenr(Justcl)m=sayWherer(m$$prettyTCMcl)panic::String->TCMDocpanics=fwords$"Panic: "++snameWithBinding::QName->TCMDocnameWithBindingq=sep[prettyTCMq,text"bound at",text(showr)]wherer=nameBindingSite$qnameNameqtcErrString::TCErr->StringtcErrStringerr=show(getRangeerr)++" "++caseerrErrorerrofTypeError_cl->errorString$clValueclExceptionrs->showr++" "++sIOExceptionre->showr++" "++showePatternErr_->"PatternErr"{- AbortAssign _ -> "AbortAssign" -- UNUSED -}errorString::TypeError->StringerrorStringerr=caseerrofAmbiguousModule{}->"AmbiguousModule"AmbiguousName{}->"AmbiguousName"AmbiguousParseForApplication{}->"AmbiguousParseForApplication"AmbiguousParseForLHS{}->"AmbiguousParseForLHS"AmbiguousTopLevelModuleName{}->"AmbiguousTopLevelModuleName"BothWithAndRHS->"BothWithAndRHS"BuiltinInParameterisedModule{}->"BuiltinInParameterisedModule"BuiltinMustBeConstructor{}->"BuiltinMustBeConstructor"ClashingDefinition{}->"ClashingDefinition"ClashingFileNamesFor{}->"ClashingFileNamesFor"ClashingImport{}->"ClashingImport"ClashingModule{}->"ClashingModule"ClashingModuleImport{}->"ClashingModuleImport"CompilationError{}->"CompilationError"ConstructorPatternInWrongDatatype{}->"ConstructorPatternInWrongDatatype"CoverageFailure{}->"CoverageFailure"CoverageCantSplitOn{}->"CoverageCantSplitOn"CoverageCantSplitIrrelevantType{}->"CoverageCantSplitIrrelevantType"CoverageCantSplitType{}->"CoverageCantSplitType"CyclicModuleDependency{}->"CyclicModuleDependency"DataMustEndInSort{}->"DataMustEndInSort"DifferentArities->"DifferentArities"DoesNotConstructAnElementOf{}->"DoesNotConstructAnElementOf"DuplicateBuiltinBinding{}->"DuplicateBuiltinBinding"DuplicateConstructors{}->"DuplicateConstructors"DuplicateFields{}->"DuplicateFields"DuplicateImports{}->"DuplicateImports"FieldOutsideRecord->"FieldOutsideRecord"FileNotFound{}->"FileNotFound"GenericError{}->"GenericError"IFSNoCandidateInScope{}->"IFSNoCandidateInScope"IlltypedPattern{}->"IlltypedPattern"IncompletePatternMatching{}->"IncompletePatternMatching"IndexFreeInParameter{}->"IndexFreeInParameter"IndexVariablesNotDistinct{}->"IndexVariablesNotDistinct"IndicesNotConstructorApplications{}->"IndicesNotConstructorApplications"InternalError{}->"InternalError"InvalidPattern{}->"InvalidPattern"LocalVsImportedModuleClash{}->"LocalVsImportedModuleClash"MetaCannotDependOn{}->"MetaCannotDependOn"MetaOccursInItself{}->"MetaOccursInItself"ModuleArityMismatch{}->"ModuleArityMismatch"ModuleDefinedInOtherFile{}->"ModuleDefinedInOtherFile"ModuleDoesntExport{}->"ModuleDoesntExport"ModuleNameDoesntMatchFileName{}->"ModuleNameDoesntMatchFileName"NoBindingForBuiltin{}->"NoBindingForBuiltin"NoParseForApplication{}->"NoParseForApplication"NoParseForLHS{}->"NoParseForLHS"NoRHSRequiresAbsurdPattern{}->"NoRHSRequiresAbsurdPattern"NotInductive{}->"NotInductive"AbsurdPatternRequiresNoRHS{}->"AbsurdPatternRequiresNoRHS"NoSuchBuiltinName{}->"NoSuchBuiltinName"NoSuchModule{}->"NoSuchModule"NoSuchPrimitiveFunction{}->"NoSuchPrimitiveFunction"NotAModuleExpr{}->"NotAModuleExpr"NotAProperTerm->"NotAProperTerm"NotAValidLetBinding{}->"NotAValidLetBinding"NotAnExpression{}->"NotAnExpression"NotImplemented{}->"NotImplemented"NotSupported{}->"NotSupported"NotInScope{}->"NotInScope"NotLeqSort{}->"NotLeqSort"NotStrictlyPositive{}->"NotStrictlyPositive"NothingAppliedToHiddenArg{}->"NothingAppliedToHiddenArg"NothingAppliedToInstanceArg{}->"NothingAppliedToInstanceArg"OverlappingProjects{}->"OverlappingProjects"PatternShadowsConstructor{}->"PatternShadowsConstructor"PropMustBeSingleton->"PropMustBeSingleton"RepeatedVariablesInPattern{}->"RepeatedVariablesInPattern"SafeFlagPostulate{}->"SafeFlagPostulate"SafeFlagPragma{}->"SafeFlagPragma"SafeFlagPrimTrustMe{}->"SafeFlagPrimTrustMe"ShadowedModule{}->"ShadowedModule"ShouldBeASort{}->"ShouldBeASort"ShouldBeApplicationOf{}->"ShouldBeApplicationOf"ShouldBeAppliedToTheDatatypeParameters{}->"ShouldBeAppliedToTheDatatypeParameters"ShouldBeEmpty{}->"ShouldBeEmpty"ShouldBePi{}->"ShouldBePi"ShouldBeRecordType{}->"ShouldBeRecordType"ShouldEndInApplicationOfTheDatatype{}->"ShouldEndInApplicationOfTheDatatype"TerminationCheckFailed{}->"TerminationCheckFailed"TooFewFields{}->"TooFewFields"TooManyArgumentsInLHS{}->"TooManyArgumentsInLHS"TooManyFields{}->"TooManyFields"SplitOnIrrelevant{}->"SplitOnIrrelevant"DefinitionIsIrrelevant{}->"DefinitionIsIrrelevant"VariableIsIrrelevant{}->"VariableIsIrrelevant"UnequalRelevance{}->"UnequalRelevance"UnequalHiding{}->"UnequalHiding"UnequalLevel{}->"UnequalLevel"UnequalSorts{}->"UnequalSorts"UnequalTerms{}->"UnequalTerms"UnequalTypes{}->"UnequalTypes"UnequalTelescopes{}->"UnequalTelescopes"HeterogeneousEquality{}->"HeterogeneousEquality"UnexpectedWithPatterns{}->"UnexpectedWithPatterns"UninstantiatedDotPattern{}->"UninstantiatedDotPattern"UninstantiatedModule{}->"UninstantiatedModule"UnreachableClauses{}->"UnreachableClauses"UnsolvedConstraints{}->"UnsolvedConstraints"UnsolvedMetas{}->"UnsolvedMetas"WithClausePatternMismatch{}->"WithClausePatternMismatch"WrongHidingInApplication{}->"WrongHidingInApplication"WrongHidingInLHS{}->"WrongHidingInLHS"WrongHidingInLambda{}->"WrongHidingInLambda"WrongIrrelevanceInLambda{}->"WrongIrrelevanceInLambda"WrongNumberOfConstructorArguments{}->"WrongNumberOfConstructorArguments"instancePrettyTCMTCErrwhereprettyTCMerr=caseerrErrorerrofTypeErrorse->dos0<-getputsd<-sayWhen(envRange$clEnve)(envCall$clEnve)$prettyTCMeputs0returndExceptionrs->sayWherer$fwordssIOExceptionre->sayWherer$fwords$showePatternErr_->sayWhereerr$panic"uncaught pattern violation"{- AbortAssign _ -> sayWhere err $ panic "uncaught aborted assignment" -- UNUSED -}instancePrettyTCMTypeErrorwhereprettyTCMerr=docaseerrofInternalErrors->panicsNotImplementeds->fwords$"Not implemented: "++sNotSupporteds->fwords$"Not supported: "++sCompilationErrors->sep[fwords"Compilation error:",texts]GenericErrors->fwordssTerminationCheckFailedbecause->fwords"Termination checking failed for the following functions:"$$(nest2$fsep(punctuatecomma(map(text.show.qnameName)(concatMaptermErrFunctionsbecause))))$$fwords"Problematic calls:"$$(nest2$vcat$map(\c->letcall=text(callInfoCallc)incaseshow(callInfoRangec)of""->callr->call$$nest2(text"(at"<+>textr<>text")"))(concatMaptermErrCallsbecause))PropMustBeSingleton->fwords"Datatypes in Prop must have at most one constructor when proof irrelevance is enabled"DataMustEndInSortt->fsep$pwords"The type of a datatype must end in a sort."++[prettyTCMt]++pwords"isn't a sort."ShouldEndInApplicationOfTheDatatypet->fsep$pwords"The target of a constructor must be the datatype applied to its parameters,"++[prettyTCMt]++pwords"isn't"ShouldBeAppliedToTheDatatypeParametersst->fsep$pwords"The target of the constructor should be"++[prettyTCMs]++pwords"instead of"++[prettyTCMt]ShouldBeApplicationOftq->fsep$pwords"The pattern constructs an element of"++[prettyTCMq]++pwords"which is not the right datatype"ShouldBeRecordTypet->fsep$pwords"Expected record type, found "++[prettyTCMt]DifferentArities->fwords"The number of arguments in the defining equations differ"WrongHidingInLHSt->dofwords"Found an implicit argument where an explicit argument was expected"WrongHidingInLambdat->dofwords"Found an implicit lambda where an explicit lambda was expected"WrongIrrelevanceInLambdat->dofwords"Found an irrelevant lambda where a relevant lambda was expected"WrongHidingInApplicationt->dofwords"Found an implicit application where an explicit application was expected"NotInductivet->fsep$[prettyTCMt]++pwords"is not an inductive data type"UninstantiatedDotPatterne->fsep$pwords"Failed to infer the value of dotted pattern"IlltypedPatternpa->fsep$pwords"Type mismatch"TooManyArgumentsInLHSna->fsep$pwords"Left hand side gives too many arguments to a function of type"++[prettyTCMa]WrongNumberOfConstructorArgumentscexpectgiven->fsep$pwords"The constructor"++[prettyTCMc]++pwords"expects"++[text(showexpect)]++pwords"arguments, but has been given"++[text(showgiven)]DoesNotConstructAnElementOfct->fsep$pwords"the constructor"++[prettyTCMc]++pwords"does not construct an element of"++[prettyTCMt]ConstructorPatternInWrongDatatypecd->fsep$[prettyTCMc]++pwords"is not a constructor of the datatype"++[prettyTCMd]IndicesNotConstructorApplicationsis->fsep(pwords"The following indices are not constructors"++pwords"(or literals) applied to variables:")$$nest2(vcat$mapprettyTCMis)IndexVariablesNotDistinctis->fsep(pwords"The variables in the following indices are not distinct:")$$nest2(vcat$mapprettyTCMis)IndexFreeInParameteripars->fsep(pwords"The index"++[prettyTCM(I.Vari[])]++pwords"is free in the following parameters:")$$nest2(vcat$mapprettyTCMpars)ShadowedModule[]->__IMPOSSIBLE__ShadowedModulems@(m:_)->fsep$pwords"Duplicate definition of module"++[prettyTCMm<>text"."]++pwords"Previous definition at"++[text$showr]wherer=case[r|r<-map(defSiteOfLast.mnameToList)ms,r/=noRange]of[]->noRanger:_->rdefSiteOfLast[]=noRangedefSiteOfLastns=nameBindingSite(lastns)ModuleArityMismatchmEmptyTelargs->fsep$pwords"The module"++[prettyTCMm]++pwords"is not parameterized, but is being applied to arguments"ModuleArityMismatchmtel@(ExtendTel__)args->fsep$pwords"The arguments to "++[prettyTCMm]++pwords"does not fit the telescope"++[prettyTCMtel]ShouldBeEmptyt[]->fsep$[prettyTCMt]++pwords"should be empty, but that's not obvious to me"ShouldBeEmptytps->fsep([prettyTCMt]++pwords"should be empty, but the following constructor patterns are valid:")$$nest2(vcat$map(showPat0)ps)ShouldBeASortt->fsep$[prettyTCMt]++pwords"should be a sort, but it isn't"ShouldBePit->fsep$[prettyTCMt]++pwords"should be a function type, but it isn't"NotAProperTerm->fwords"Found a malformed term"SplitOnIrrelevantpt->fsep$pwords"Cannot pattern match"++[prettyAp]++pwords"against irrelevant type"++[prettyTCMt]DefinitionIsIrrelevantx->fsep$text"Identifier":prettyTCMx:pwords"is declared irrelevant, so it cannot be used here"VariableIsIrrelevantx->fsep$text"Variable":prettyTCMx:pwords"is declared irrelevant, so it cannot be used here"UnequalTermscmpsta->fsep$[prettyTCMs,fcmp,prettyTCMt]++pwords"of type"++[prettyTCMa]wherefCmpEq=text"!="fCmpLeq=text"!=<"UnequalLevelcmpst->fsep$[prettyTCMs,fcmp,prettyTCMt]wherefCmpEq=text"!="fCmpLeq=text"!=<"UnequalTelescopescmpab->fsep$[prettyTCMa,fcmp,prettyTCMb]wherefCmpEq=text"!="fCmpLeq=text"!=<"UnequalTypescmpab->fsep$[prettyTCMa,fcmp,prettyTCMb]wherefCmpEq=text"!="fCmpLeq=text"!=<"HeterogeneousEqualityuavb->fsep$pwords"Refuse to solve heterogeneous constraint"++[prettyTCMu]++pwords":"++[prettyTCMa]++pwords"=?="++[prettyTCMv]++pwords":"++[prettyTCMb]UnequalRelevanceab->fsep$[prettyTCMa]++pwords"!="++[prettyTCMb]++-- Andreas 2010-09-21 to reveal Forced annotations, print also uglily-- [text $ show a] ++ pwords "!=" ++ [text $ show b] ++pwords"because one is a relevant function type and the other is an irrelevant function type"UnequalHidingab->fsep$[prettyTCMa]++pwords"!="++[prettyTCMb]++pwords"because one is an implicit function type and the other is an explicit function type"UnequalSortss1s2->fsep$[prettyTCMs1]++pwords"!="++[prettyTCMs2]NotLeqSorts1s2->fsep$pwords"The type of the constructor does not fit in the sort of the datatype, since"++[prettyTCMs1]++pwords"is not less or equal than"++[prettyTCMs2]TooFewFieldsrxs->fsep$pwords"Missing fields"++punctuatecomma(mapprettyxs)++pwords"in an element of the record"++[prettyTCMr]TooManyFieldsrxs->fsep$pwords"The record type"++[prettyTCMr]++pwords"does not have the fields"++punctuatecomma(mapprettyxs)DuplicateConstructorsxs->fsep$pwords"Duplicate constructors"++punctuatecomma(mapprettyxs)++pwords"in datatype"DuplicateFieldsxs->fsep$pwords"Duplicate fields"++punctuatecomma(mapprettyxs)++pwords"in record"UnexpectedWithPatternsps->fsep$pwords"Unexpected with patterns"++(punctuate(text" |")$mapprettyAps)WithClausePatternMismatchpq->fsep$pwords"With clause pattern"++[prettyAp]++pwords"is not an instance of its parent pattern"-- TODO: pretty for internal patternsMetaCannotDependOnmpsi->fsep$pwords"The metavariable"++[prettyTCM$MetaVm[]]++pwords"cannot depend on"++[pvari]++pwords"because it"++depswherepvari=prettyTCM$I.Vari[]deps=casemappvarpsof[]->pwords"does not depend on any variables"[x]->pwords"only depends on the variable"++[x]xs->pwords"only depends on the variables"++punctuatecommaxsMetaOccursInItselfm->fsep$pwords"Cannot construct infinite solution of metavariable"++[prettyTCM$MetaVm[]]BuiltinMustBeConstructorse->fsep$[prettyAe]++pwords"must be a constructor in the binding to builtin"++[texts]NoSuchBuiltinNames->fsep$pwords"There is no built-in thing called"++[texts]DuplicateBuiltinBindingbxy->fsep$pwords"Duplicate binding for built-in thing"++[textb<>comma]++pwords"previous binding to"++[prettyTCMx]NoBindingForBuiltinx->fsep$pwords"No binding for builtin thing"++[textx<>comma]++pwords("use {-# BUILTIN "++x++" name #-} to bind it to 'name'")NoSuchPrimitiveFunctionx->fsep$pwords"There is no primitive function called"++[textx]BuiltinInParameterisedModulex->fwords$"The BUILTIN pragma cannot appear inside a bound context "++"(for instance, in a parameterised module or as a local declaration)"NoRHSRequiresAbsurdPatternps->fwords$"The right-hand side can only be omitted if there "++"is an absurd pattern, () or {}, in the left-hand side."AbsurdPatternRequiresNoRHSps->fwords$"The right-hand side must be omitted if there "++"is an absurd pattern, () or {}, in the left-hand side."LocalVsImportedModuleClashm->fsep$pwords"The module"++[text$showm]++pwords"can refer to either a local module or an imported module"UnsolvedMetasrs->fsep(pwords"Unsolved metas at the following locations:")$$nest2(vcat$map(text.show)rs)UnsolvedConstraintscs->fsep(pwords"Failed to solve the following constraints:")$$nest2(vcat$mapprettyTCMcs)CyclicModuleDependencyms->fsep(pwords"cyclic module dependency:")$$nest2(vcat$mapprettyms)FileNotFoundxfiles->fsep(pwords"Failed to find source of module"++[prettyx]++pwords"in any of the following locations:")$$nest2(vcat$map(text.filePath)files)OverlappingProjectsfm1m2->fsep(pwords"The file"++[text(filePathf)]++pwords"can be accessed via several project roots. Both"++[prettym1]++pwords"and"++[prettym2]++pwords"point to this file.")AmbiguousTopLevelModuleNamexfiles->fsep(pwords"Ambiguous module name. The module name"++[prettyx]++pwords"could refer to any of the following files:")$$nest2(vcat$map(text.filePath)files)ClashingFileNamesForxfiles->fsep(pwords"Multiple possible sources for module"++[text$showx]++pwords"found:")$$nest2(vcat$map(text.filePath)files)ModuleDefinedInOtherFilemodfilefile'->fsep$pwords"You tried to load"++[text(filePathfile)]++pwords"which defines the module"++[prettymod<>text"."]++pwords"However, according to the include path this module should"++pwords"be defined in"++[text(filePathfile')<>text"."]ModuleNameDoesntMatchFileNamegivenfiles->fsep(pwords"The name of the top level module does not match the file name. The module"++[prettygiven]++pwords"should be defined in one of the following files:")$$nest2(vcat$map(text.filePath)files)BothWithAndRHS->fsep$pwords"Unexpected right hand side"NotInScopexs->fsep(pwords"Not in scope:")$$nest2(vcat$mapnamexs)wherenamex=fsep[prettyx,text"at"<+>text(show$getRangex),suggestion(showx)]suggestions|elem':'s=parens$text"did you forget space around the ':'?"|elem"->"two=parens$text"did you forget space around the '->'?"|otherwise=emptywheretwo=zipWith(\ab->[a,b])s(tails)NoSuchModulex->fsep$pwords"No such module"++[prettyx]AmbiguousNamexys->vcat[fsep$pwords"Ambiguous name"++[prettyx<>text"."]++pwords"It could refer to any one of",nest2$vcat$mapnameWithBindingys]AmbiguousModulexys->vcat[fsep$pwords"Ambiguous module name"++[prettyx<>text"."]++pwords"It could refer to any one of",nest2$vcat$mapprettyTCMys]UninstantiatedModulex->fsep(pwords"Cannot access the contents of the parameterised module"++[prettyx<>text"."]++pwords"To do this the module first has to be instantiated. For instance:")$$nest2(hsep[text"module",prettyx<>text"'",text"=",prettyx,text"e1 .. en"])ClashingDefinitionxy->fsep$pwords"Multiple definitions of"++[prettyx<>text"."]++pwords"Previous definition at"++[text$show$nameBindingSite$qnameNamey]ClashingModulem1m2->fsep$pwords"The modules"++[prettyTCMm1,text"and",prettyTCMm2]++pwords"clash."ClashingImportxy->fsep$pwords"Import clash between"++[prettyx,text"and",prettyTCMy]ClashingModuleImportxy->fsep$pwords"Module import clash between"++[prettyx,text"and",prettyTCMy]PatternShadowsConstructorxc->fsep$pwords"The pattern variable"++[prettyTCMx]++pwords"has the same name as the constructor"++[prettyTCMc]DuplicateImportsmxs->fsep$pwords"Ambiguous imports from module"++[prettym]++pwords"for"++punctuatecomma(mapprettyxs)ModuleDoesntExportmxs->fsep$pwords"The module"++[prettym]++pwords"doesn't export the following:"++punctuatecomma(mapprettyxs)NotAModuleExpre->fsep$pwords"The right-hand side of a module definition must have the form 'M e1 .. en'"++pwords"where M is a module name. The expression"++[prettye,text"doesn't."]FieldOutsideRecord->fsep$pwords"Field appearing outside record declaration."InvalidPatternp->fsep$prettyp:pwords"is not a valid pattern"RepeatedVariablesInPatternxs->fsep$pwords"Repeated variables in left hand side:"++mapprettyxsNotAnExpressione->fsep$[prettye]++pwords"is not a valid expression."NotAValidLetBindingnd->fwords$"Not a valid let-declaration"NothingAppliedToHiddenArge->fsep$[prettye]++pwords"cannot appear by itself. It needs to be the argument to"++pwords"a function expecting an implicit argument."NothingAppliedToInstanceArge->fsep$[prettye]++pwords"cannot appear by itself. It needs to be the argument to"++pwords"a function expecting an instance argument."NoParseForApplicationes->fsep$pwords"Could not parse the application"++[pretty$C.RawAppnoRangees]AmbiguousParseForApplicationeses'->fsep(pwords"Don't know how to parse"++[pretty(C.RawAppnoRangees)<>text"."]++pwords"Could mean any one of:")$$nest2(vcat$mapprettyes')NoParseForLHSp->fsep$pwords"Could not parse the left-hand side"++[prettyp]AmbiguousParseForLHSpps->fsep(pwords"Don't know how to parse"++[prettyp<>text"."]++pwords"Could mean any one of:")$$nest2(vcat$mapprettyps)IncompletePatternMatchingvargs->fsep$pwords"Incomplete pattern matching for"++[prettyTCMv<>text"."]++pwords"No match for"++mapprettyTCMargsUnreachableClausesfpss->fsep$pwords"Unreachable"++pwords(plural(lengthpss)"clause")whereplural1thing=thingpluralnthing=thing++"s"CoverageFailurefpss->fsep(pwords"Incomplete pattern matching for"++[prettyTCMf<>text"."]++pwords"Missing cases:")$$nest2(vcat$mapdisplaypss)wheredisplayps=dops<-nicifyfpsprettyTCMf<+>fsep(mapshowArgps)nicifyfps=doshowImp<-showImplicitArgumentsifshowImpthenreturnpselsereturnps-- TODO: remove implicit arguments which aren't constructorsCoverageCantSplitOnctelcIxsgIxs->inContext[]$addCtxTeltel$vcat[fsep$pwords"Cannot decide whether there should be a case for the constructor"++[prettyTCMc<>text","]++pwords"since the unification gets stuck on unifying the inferred indices",nest2$prettyTCMcIxs,fsep$pwords"with the expected indices",nest2$prettyTCMgIxs]CoverageCantSplitIrrelevantTypea->fsep$pwords"Cannot split on argument of irrelevant datatype"++[prettyTCMa]CoverageCantSplitTypea->fsep$pwords"Cannot split on argument of non-datatype"++[prettyTCMa]NotStrictlyPositivedocs->fsep$pwords"The datatype"++[prettyTCMd]++pwords"is not strictly positive, because"++prettyOcc"it"ocswhereprettyOcc_[]=[]prettyOccit(OccCondcr:ocs)=concat[pwordsit,pwords"occurs",prettyRr,pwords"in the constructor",[prettyTCMc],pwords"of",[prettyTCMd<>comocs],prettyOcc"which"ocs]prettyOccit(OccClausefnr:ocs)=concat[pwordsit,pwords"occurs",prettyRr,pwords"in the",[thn],pwords"clause of",[prettyTCMf<>comocs],prettyOcc"which"ocs]prettyRNonPositively=pwords"negatively"prettyR(ArgumentToiq)=pwords"as the"++[thi]++pwords"argument to"++[prettyTCMq]th0=text"first"th1=text"second"th2=text"third"thn=text(show$n-1)<>text"th"com[]=emptycom(_:_)=commaIFSNoCandidateInScopet->fsep$pwords"No variable of type"++[prettyTCMt]++pwords"was found in scope."SafeFlagPostulatee->fsep$pwords"Cannot postulate"++[prettye]++pwords"with safe flag"SafeFlagPragmaxs->letplural|lengthxs==1=""|otherwise="s"infsep$[fwords("Cannot set OPTION pragma"++plural)]++maptextxs++[fwords"with safe flag."]SafeFlagPrimTrustMe->fsep(pwords"Cannot use primTrustMe with safe flag")wheremparnargs|n>0&&not(nullargs)=parens|otherwise=idshowArg(ArgHiddenrx)=braces$showPat0xshowArg(ArgInstancerx)=dbraces$showPat0xshowArg(ArgNotHiddenrx)=showPat1xshowPat_(I.VarP_)=text"_"showPat_(I.DotP_)=text"._"showPatn(I.ConPc_args)=mparnargs$prettyTCMc<+>fsep(mapshowArgargs)showPat_(I.LitPl)=text(showl)instancePrettyTCMCallwhereprettyTCMc=casecofCheckClausetcl_->fsep$pwords"when checking that the clause"++[P.prettyAcl]++pwords"has type"++[prettyTCMt]CheckPatternptelt_->addCtxTeltel$fsep$pwords"when checking that the pattern"++[prettyAp]++pwords"has type"++[prettyTCMt]CheckLetBindingb_->fsep$pwords"when checking the let binding"++[P.prettyAb]InferExpre_->fsep$pwords"when inferring the type of"++[prettyAe]CheckExpret_->fsep$pwords"when checking that the expression"++[prettyAe]++pwords"has type"++[prettyTCMt]IsTypeCalles_->fsep$pwords"when checking that the expression"++[prettyAe]++pwords"is a type of sort"++[prettyTCMs]IsType_e_->fsep$pwords"when checking that the expression"++[prettyAe]++pwords"is a type"CheckArgumentsrest0t1_->fsep$pwords"when checking that"++maphPrettyes++pwords"are valid arguments to a function of type"++[prettyTCMt0]CheckRecDef_xpscs_->fsep$pwords"when checking the definition of"++[prettyTCMx]CheckDataDef_xpscs_->fsep$pwords"when checking the definition of"++[prettyTCMx]CheckConstructord__(A.Axiom__c_)_->fsep$pwords"when checking the constructor"++[prettyTCMc]++pwords"in the declaration of"++[prettyTCMd]CheckConstructor_____->__IMPOSSIBLE__CheckFunDef_f__->fsep$pwords"when checking the definition of"++[prettyTCMf]CheckPragma_p_->fsep$pwords"when checking the pragma"++[prettyA$RangeAndPragmanoRangep]CheckPrimitive_xe_->fsep$pwords"when checking that the type of the primitive function"++[prettyTCMx]++pwords"is"++[prettyAe]CheckWithFunctionTypee_->fsep$pwords"when checking that the type"++[prettyAe]++pwords"of the generated with function is well-formed"CheckDotPatternev_->fsep$pwords"when checking that the given dot pattern"++[prettyAe]++pwords"matches the inferred value"++[prettyTCMv]CheckPatternShadowingc_->fsep$pwords"when checking the clause"++[P.prettyAc]InferVarx_->fsep$pwords"when inferring the type of"++[prettyTCMx]InferDef_x_->fsep$pwords"when inferring the type of"++[prettyTCMx]CheckIsEmptyt_->fsep$pwords"when checking that"++[prettyTCMt]++pwords"has no constructors"ScopeCheckExpre_->fsep$pwords"when scope checking"++[prettye]ScopeCheckDeclarationd_->fwords"when scope checking the declaration"$$nest2(pretty$simpleDecld)ScopeCheckLHSxp_->fsep$pwords"when scope checking the left-hand side"++[prettyp]++pwords"in the definition of"++[prettyx]TermFunDef_f__->fsep$pwords"when termination checking the definition of"++[prettyTCMf]SetRanger_->fsep$pwords"when doing something at"++[text$showr]CheckSectionApplication_m1modapp_->fsep$pwords"when checking the module application"++[prettyA$A.Applyinfom1modappMap.emptyMap.empty]whereinfo=A.ModuleInfonoRangenoRangeNothingNothingNothingwherehPrettya=pretty=<<abstractToConcreteCtx(hiddenArgumentCtx(argHidinga))asimpleDecld=d'where[d']=D.notSoNiceDeclarations[d]