{-# LANGUAGE PatternSynonyms #-}
module Liquid.GHC.API (
module Ghc
) where
import Liquid.GHC.API.Extra as Ghc
import GHC as Ghc
( Backend(Interpreter)
, Class
, DataCon
, DesugaredModule(DesugaredModule, dm_typechecked_module, dm_core_module)
, DynFlags(backend, debugLevel, ghcLink, ghcMode)
, FixityDirection(InfixN, InfixR)
, FixitySig(FixitySig)
, GenLocated(L)
, GeneralFlag
( Opt_DeferTypedHoles
, Opt_Haddock
, Opt_ImplicitImportQualified
, Opt_KeepRawTokenStream
, Opt_PIC
)
, Ghc
, GhcException(CmdLineError, ProgramError)
, GhcLink(LinkInMemory)
, GhcMode(CompManager)
, GhcPs
, GhcRn
, HsDecl(SigD)
, HsExpr(ExprWithTySig, HsOverLit, HsVar)
, HsModule(hsmodDecls)
, HsOuterTyVarBndrs(HsOuterImplicit)
, HsSigType(HsSig)
, HsTyVarBndr(UserTyVar)
, HsType(HsAppTy, HsForAllTy, HsQualTy, HsTyVar, HsWildCardTy)
, HsArg(HsValArg)
, HsWildCardBndrs(HsWC)
, Id
, IdP
, Kind
, LHsDecl
, LHsExpr
, LHsType
, LImportDecl
, LexicalFixity(Prefix)
, Located
, LocatedN
, Logger
, ModIface_(mi_anns, mi_exports, mi_globals, mi_module)
, ModLocation(ml_hs_file)
, ModSummary(ms_hspp_file, ms_hspp_opts, ms_location, ms_mod)
, Module
, ModuleName
, Name
, NamedThing
, ParsedModule (pm_mod_summary, pm_parsed_source)
, PredType
, RealSrcLoc
, RealSrcSpan
, RdrName
, Severity(SevWarning)
, Sig(InlineSig, FixSig, TypeSig)
, SrcLoc
, StrictnessMark
, TyCon
, TyThing(AConLike, ATyCon, AnId)
, TyVar
, TypecheckedModule(tm_checked_module_info, tm_internals_, tm_parsed_module)
, classMethods
, classSCTheta
, dataConTyCon
, dataConFieldLabels
, dataConWrapperType
, getLocA
, getLogger
, getName
, getOccName
, getSession
, gopt
, hsTypeToHsSigType
, hsTypeToHsSigWcType
, idDataCon
, idType
, ideclAs
, ideclName
, instanceDFunId
, isClassOpId_maybe
, isClassTyCon
, isDictonaryId
, isExternalName
, isFamilyTyCon
, isFunTyCon
, isGoodSrcSpan
, isLocalId
, isNewTyCon
, isPrimTyCon
, isRecordSelector
, isTypeSynonymTyCon
, isVanillaDataCon
, mkHsApp
, mkHsDictLet
, mkHsForAllInvisTele
, mkHsFractional
, mkHsIntegral
, mkHsLam
, mkModuleName
, mkSrcLoc
, mkSrcSpan
, modInfoTopLevelScope
, moduleName
, moduleNameString
, moduleUnit
, ms_mod_name
, nameModule
, nameSrcSpan
, nlHsAppTy
, nlHsFunTy
, nlHsIf
, nlHsTyConApp
, nlHsTyVar
, nlHsVar
, nlList
, nlVarPat
, noAnn
, noAnnSrcSpan
, noExtField
, noLocA
, noSrcSpan
, splitForAllTyCoVars
, srcLocFile
, srcLocCol
, srcLocLine
, srcSpanEndCol
, srcSpanEndLine
, srcSpanFile
, srcSpanStartCol
, srcSpanStartLine
, synTyConDefn_maybe
, synTyConRhs_maybe
, tyConArity
, tyConClass_maybe
, tyConDataCons
, tyConKind
, tyConTyVars
, unLoc
)
import GHC.Builtin.Names as Ghc
( Uniquable
, Unique
, and_RDR
, bindMName
, dATA_FOLDABLE
, dollarIdKey
, eqClassKey
, eqClassName
, ge_RDR
, gt_RDR
, fractionalClassKey
, fractionalClassKeys
, gHC_REAL
, getUnique
, hasKey
, isStringClassName
, itName
, le_RDR
, lt_RDR
, minus_RDR
, negateName
, not_RDR
, numericClassKeys
, ordClassKey
, ordClassName
, plus_RDR
, times_RDR
, varQual_RDR
)
import GHC.Builtin.Types as Ghc
( anyTy
, boolTy
, boolTyCon
, boolTyConName
, charDataCon
, charTyCon
, consDataCon
, falseDataCon
, falseDataConId
, intDataCon
, intTy
, intTyCon
, intTyConName
, liftedTypeKind
, listTyCon
, listTyConName
, naturalTy
, nilDataCon
, stringTy
, true_RDR
, trueDataCon
, trueDataConId
, tupleDataCon
, tupleTyCon
, typeSymbolKind
)
import GHC.Builtin.Types.Prim as Ghc
( eqPrimTyCon
, eqReprPrimTyCon
, primTyCons
)
import GHC.Builtin.Utils as Ghc
( isNumericClass )
import GHC.Core as Ghc
( Alt(Alt)
, AltCon(DEFAULT, DataAlt, LitAlt)
, Arg
, Bind(NonRec, Rec)
, CoreAlt
, CoreArg
, CoreBind
, CoreBndr
, CoreExpr
, CoreProgram
, Expr(App, Case, Cast, Coercion, Lam, Let, Lit, Tick, Type, Var)
, Unfolding(CoreUnfolding, DFunUnfolding, uf_tmpl)
, bindersOf
, cmpAlt
, collectArgs
, collectBinders
, collectTyAndValBinders
, collectTyBinders
, flattenBinds
, isId
, isTypeArg
, maybeUnfoldingTemplate
, mkApps
, mkLams
, mkTyApps
, mkTyArg
)
import GHC.Core.Class as Ghc
( classAllSelIds
, classBigSig
, classSCSelIds
, Class
( classKey
, className
, classTyCon
, classTyVars
)
)
import GHC.Core.Coercion as Ghc
( Role
, Var
, coercionKind
, isCoVar
, mkRepReflCo
)
import GHC.Core.Coercion.Axiom as Ghc
( Branched
, CoAxiom
, CoAxiomRule(CoAxiomRule)
, coAxiomTyCon
)
import GHC.Core.ConLike as Ghc
( ConLike(RealDataCon) )
import GHC.Core.DataCon as Ghc
( FieldLabel(flSelector)
, classDataCon
, dataConExTyCoVars
, dataConFullSig
, dataConImplicitTyThings
, dataConInstArgTys
, dataConName
, dataConOrigArgTys
, dataConRepArgTys
, dataConRepType
, dataConRepStrictness
, dataConTheta
, dataConUnivTyVars
, dataConWorkId
, dataConWrapId
, dataConWrapId_maybe
, isTupleDataCon
)
import GHC.Core.FamInstEnv as Ghc
( FamFlavor(DataFamilyInst)
, FamInst(FamInst, fi_flavor)
, FamInstEnv
, FamInstEnvs
, emptyFamInstEnv
, famInstEnvElts
, topNormaliseType_maybe
)
import GHC.Core.InstEnv as Ghc
( ClsInst(is_cls, is_dfun, is_dfun_name, is_tys)
, DFunId
, instEnvElts
, instanceSig
)
import GHC.Core.Make as Ghc
( mkCoreApps
, mkCoreConApps
, mkCoreLams
, mkCoreLets
, pAT_ERROR_ID
)
import GHC.Core.Predicate as Ghc (getClassPredTys_maybe, getClassPredTys, isEvVarType, isEqPrimPred, isEqPred, isClassPred, isDictId, mkClassPred)
import GHC.Core.Subst as Ghc (deShadowBinds, emptySubst, extendCvSubst)
import GHC.Core.TyCo.Rep as Ghc
( AnonArgFlag(VisArg)
, ArgFlag(Required)
, Coercion
( AppCo
, AxiomRuleCo
, AxiomInstCo
, CoVarCo
, ForAllCo
, FunCo
, InstCo
, KindCo
, LRCo
, NthCo
, SubCo
, SymCo
, TransCo
, TyConAppCo
, UnivCo
)
, TyLit(CharTyLit, NumTyLit, StrTyLit)
, Type
( AppTy
, CastTy
, CoercionTy
, ForAllTy
, FunTy
, LitTy
, TyConApp
, TyVarTy
, ft_arg
, ft_res
)
, UnivCoProvenance(PhantomProv, ProofIrrelProv)
, binderVar
, mkForAllTys
, mkFunTy
, mkTyVarTy
, mkTyVarTys
)
import GHC.Core.TyCon as Ghc
( TyConBinder
, TyConBndrVis(AnonTCB)
, isAlgTyCon
, isBoxedTupleTyCon
, isFamInstTyCon
, isGadtSyntaxTyCon
, isPromotedDataCon
, isTupleTyCon
, isVanillaAlgTyCon
, mkKindTyCon
, newTyConRhs
, tyConBinders
, tyConDataCons_maybe
, tyConFamInst_maybe
, tyConName
, tyConSingleDataCon_maybe
)
import GHC.Core.Type as Ghc
( Specificity(SpecifiedSpec)
, TyVarBinder
, pattern Many
, classifiesTypeWithValues
, dropForAlls
, emptyTvSubstEnv
, eqType
, expandTypeSynonyms
, irrelevantMult
, isFunTy
, isTyVar
, isTyVarTy
, mkTvSubstPrs
, mkTyConApp
, newTyConInstRhs
, nonDetCmpType
, piResultTys
, splitAppTys
, splitFunTy_maybe
, splitFunTys
, splitTyConApp
, splitTyConApp_maybe
, substTy
, substTyWith
, tyConAppArgs_maybe
, tyConAppTyCon_maybe
, tyVarKind
, varType
)
import GHC.Core.Unify as Ghc
( ruleMatchTyKiX, tcUnifyTy )
import GHC.Core.Utils as Ghc (exprType)
import GHC.Data.Bag as Ghc
( Bag, bagToList )
import GHC.Data.FastString as Ghc
( FastString
, bytesFS
, concatFS
, fsLit
, mkFastString
, mkFastStringByteString
, sLit
, uniq
, unpackFS
)
import GHC.Data.Pair as Ghc
( Pair(Pair) )
import GHC.Driver.Main as Ghc
( hscDesugar
, hscTcRcLookupName
)
import GHC.Driver.Phases as Ghc (Phase(StopLn))
import GHC.Driver.Pipeline as Ghc (compileFile)
import GHC.Driver.Session as Ghc
( WarnReason(NoReason)
, getDynFlags
, gopt_set
, updOptLevel
, xopt_set
)
import GHC.Driver.Monad as Ghc (withSession)
import GHC.HsToCore.Monad as Ghc
( DsM, initDsTc, initDsWithModGuts, newUnique )
import GHC.Iface.Syntax as Ghc
( IfaceAnnotation(ifAnnotatedValue) )
import GHC.Plugins as Ghc ( deserializeWithData
, fromSerialized
, toSerialized
, defaultPlugin
, Plugin(..)
, CommandLineOption
, purePlugin
, extendIdSubst
, substExpr
)
import GHC.Core.FVs as Ghc (exprFreeVarsList)
import GHC.Core.Opt.OccurAnal as Ghc
( occurAnalysePgm )
import GHC.Driver.Env as Ghc
( HscEnv(hsc_EPS, hsc_HPT, hsc_dflags, hsc_plugins, hsc_static_plugins) )
import GHC.Driver.Ppr as Ghc
( showPpr
, showSDoc
, showSDocDump
)
import GHC.HsToCore.Expr as Ghc
( dsLExpr )
import GHC.Iface.Load as Ghc
( cannotFindModule
, loadInterface
)
import GHC.Rename.Expr as Ghc (rnLExpr)
import GHC.Tc.Gen.App as Ghc (tcInferSigma)
import GHC.Tc.Gen.Bind as Ghc (tcValBinds)
import GHC.Tc.Gen.Expr as Ghc (tcInferRho)
import GHC.Tc.Module as Ghc
( getModuleInterface
, tcRnLookupRdrName
)
import GHC.Tc.Solver as Ghc
( InferMode(NoRestrictions)
, captureTopConstraints
, simplifyInfer
, simplifyInteractive
)
import GHC.Tc.Types as Ghc
( Env(env_top)
, TcGblEnv(tcg_anns, tcg_exports, tcg_insts, tcg_mod, tcg_rdr_env, tcg_rn_imports)
, TcM
, TcRn
, WhereFrom(ImportBySystem)
)
import GHC.Tc.Types.Evidence as Ghc
( TcEvBinds(EvBinds) )
import GHC.Tc.Types.Origin as Ghc (lexprCtOrigin)
import GHC.Tc.Utils.Monad as Ghc
( captureConstraints
, discardConstraints
, getEnv
, failIfErrsM
, failM
, failWithTc
, initIfaceTcRn
, liftIO
, mkLongErrAt
, pushTcLevelM
, reportError
, reportErrors
)
import GHC.Tc.Utils.TcType as Ghc (tcSplitDFunTy, tcSplitMethodTy)
import GHC.Tc.Utils.Zonk as Ghc
( zonkTopLExpr )
import GHC.Types.Annotations as Ghc
( AnnPayload
, AnnTarget(ModuleTarget)
, Annotation(Annotation, ann_target, ann_value)
, findAnns
)
import GHC.Types.Avail as Ghc
( AvailInfo(Avail, AvailTC)
, availNames
, greNameMangledName
)
import GHC.Types.Basic as Ghc
( Arity
, Boxity(Boxed)
, PprPrec
, PromotionFlag(NotPromoted)
, TopLevelFlag(NotTopLevel)
, funPrec
, InlinePragma(inl_act, inl_inline, inl_rule, inl_sat, inl_src)
, isDeadOcc
, isStrongLoopBreaker
, noOccInfo
, topPrec
)
import GHC.Types.CostCentre as Ghc
( CostCentre(cc_loc)
)
import GHC.Types.Error as Ghc
( Messages
, DecoratedSDoc
, MsgEnvelope(errMsgSpan)
)
import GHC.Types.Fixity as Ghc
( Fixity(Fixity) )
import GHC.Types.Id as Ghc
( idDetails
, isDFunId
, idInfo
, idOccInfo
, isConLikeId
, modifyIdInfo
, mkExportedLocalId
, mkUserLocal
, realIdUnfolding
, setIdInfo
)
import GHC.Types.Id.Info as Ghc
( CafInfo(NoCafRefs)
, IdDetails(DataConWorkId, DataConWrapId, RecSelId, VanillaId)
, IdInfo(occInfo, unfoldingInfo)
, cafInfo
, inlinePragInfo
, mayHaveCafRefs
, setCafInfo
, setOccInfo
, vanillaIdInfo
)
import GHC.Types.Literal as Ghc
( LitNumType(LitNumInt)
, Literal(LitChar, LitDouble, LitFloat, LitNumber, LitString)
, literalType
)
import GHC.Types.Name as Ghc
( OccName
, getOccString
, getSrcSpan
, isInternalName
, isSystemName
, mkInternalName
, mkSystemName
, mkTcOcc
, mkTyVarOcc
, mkVarOcc
, mkVarOccFS
, nameModule_maybe
, nameOccName
, nameSrcLoc
, nameStableString
, occNameFS
, occNameString
, stableNameCmp
)
import GHC.Types.Name.Reader as Ghc
( ImpDeclSpec(ImpDeclSpec, is_as, is_dloc, is_mod, is_qual)
, ImportSpec(ImpSpec)
, ImpItemSpec(ImpAll)
, getRdrName
, globalRdrEnvElts
, gresFromAvails
, greMangledName
, lookupGRE_RdrName
, mkGlobalRdrEnv
, mkQual
, mkVarUnqual
, mkUnqual
, nameRdrName
)
import GHC.Types.SourceError as Ghc
( SourceError
, srcErrorMessages
)
import GHC.Types.SourceText as Ghc
( SourceText(SourceText,NoSourceText)
, mkIntegralLit
, mkTHFractionalLit
)
import GHC.Types.SrcLoc as Ghc
( SrcSpan(RealSrcSpan, UnhelpfulSpan)
, UnhelpfulSpanReason
( UnhelpfulGenerated
, UnhelpfulInteractive
, UnhelpfulNoLocationInfo
, UnhelpfulOther
, UnhelpfulWiredIn
)
, combineSrcSpans
, mkGeneralSrcSpan
, mkRealSrcLoc
, mkRealSrcSpan
, realSrcSpanStart
, srcSpanFileName_maybe
, srcSpanToRealSrcSpan
)
import GHC.Types.Tickish as Ghc (CoreTickish, GenTickish(..))
import GHC.Types.Unique as Ghc
( getKey, mkUnique )
import GHC.Types.Unique.Set as Ghc (mkUniqSet)
import GHC.Types.Unique.Supply as Ghc
( MonadUnique, getUniqueM )
import GHC.Types.Var as Ghc
( VarBndr(Bndr)
, mkLocalVar
, mkTyVar
, setVarName
, setVarType
, setVarUnique
, varName
, varUnique
)
import GHC.Types.Var.Env as Ghc
( emptyInScopeSet, mkRnEnv2 )
import GHC.Types.Var.Set as Ghc
( VarSet
, elemVarSet
, emptyVarSet
, extendVarSet
, extendVarSetList
, unitVarSet
)
import GHC.Unit.External as Ghc
( ExternalPackageState (eps_ann_env)
)
import GHC.Unit.Finder as Ghc
( FindResult(Found, NoPackage, FoundMultiple, NotFound)
, findExposedPackageModule
, findImportedModule
)
import GHC.Unit.Home.ModInfo as Ghc
( HomePackageTable, HomeModInfo(hm_iface), lookupHpt )
import GHC.Unit.Module as Ghc
( GenWithIsBoot(gwib_isBoot, gwib_mod)
, IsBootInterface(NotBoot, IsBoot)
, ModuleNameWithIsBoot
, UnitId
, fsToUnit
, mkModuleNameFS
, moduleNameFS
, moduleStableString
, toUnitId
, unitString
)
import GHC.Unit.Module.ModGuts as Ghc
( ModGuts
( mg_binds
, mg_exports
, mg_fam_inst_env
, mg_inst_env
, mg_module
, mg_tcs
, mg_usages
)
)
import GHC.Utils.Error as Ghc (withTiming)
import GHC.Utils.Logger as Ghc (putLogMsg)
import GHC.Utils.Outputable as Ghc hiding ((<>))
import GHC.Utils.Panic as Ghc (panic, throwGhcException, throwGhcExceptionIO)