-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Liquid Types for Haskell -- -- Liquid Types for Haskell. @package liquidhaskell @version 0.8.10.2 module Gradual.GUI.Misc script :: String -> String module Gradual.Misc -- | Mapping -- ------------------------------------------------------------------ mapThd3 :: (c -> d) -> (a, b, c) -> (a, b, d) mapSndM :: Functor m => (b -> m c) -> (a, b) -> m (a, c) mapMWithLog :: String -> (a -> IO b) -> [a] -> IO [b] -- | Powersets -- ---------------------------------------------------------------- powersetUpTo :: Int -> [a] -> [[a]] -- | Combining -- ---------------------------------------------------------------- flatten :: [(k, (i, [v]))] -> [[(k, (i, v))]] expand :: (a -> [a]) -> [a] -> [[a]] expand2 :: (b -> [b]) -> [(a, b)] -> [[(a, b)]] expand3 :: (c -> [c]) -> [(a, b, c)] -> [[(a, b, c)]] allCombinations :: [[a]] -> [[a]] module Gradual.Trivial simplify :: SInfo a -> SInfo a -- | This module provides a drop-in replacement for Cabal's -- defaultMain, to be used inside hs modules of packages -- that wants to use the "dev mode". For more information, visit the -- documentation, especially the "Developers' guide". module Language.Haskell.Liquid.Cabal liquidHaskellMain :: IO () -- | This module re-exports a bunch of the GHC API. module Language.Haskell.Liquid.GHC.API -- | A pure interface to the module parser. parser :: String -> DynFlags -> FilePath -> (WarningMessages, Either ErrorMessages (Located (HsModule GhcPs))) -- | Returns the TyThing for a Name. The Name may -- refer to any entity known to GHC, including Names defined using -- runStmt. lookupName :: GhcMonad m => Name -> m (Maybe TyThing) obtainTermFromId :: GhcMonad m => Int -> Bool -> Id -> m Term obtainTermFromVal :: GhcMonad m => Int -> Bool -> Type -> a -> m Term getHistorySpan :: GhcMonad m => History -> m SrcSpan -- | Get the monad GHCi lifts user statements into. getGHCiMonad :: GhcMonad m => m Name -- | Set the monad GHCi lifts user statements into. -- -- Checks that a type (in string form) is an instance of the -- GHC.GHCi.GHCiSandboxIO type class. Sets it to be the GHCi -- monad if it is, throws an error otherwise. setGHCiMonad :: GhcMonad m => String -> m () -- | Return if a module is trusted and the pkgs it depends on to be -- trusted. moduleTrustReqs :: GhcMonad m => Module -> m (Bool, Set InstalledUnitId) -- | Check that a module is safe to import (according to Safe Haskell). -- -- We return True to indicate the import is safe and False otherwise -- although in the False case an error may be thrown first. isModuleTrusted :: GhcMonad m => Module -> m Bool -- | Like findModule, but differs slightly when the module refers to -- a source file, and the file has not been loaded via load. In -- this case, findModule will throw an error (module not loaded), -- but lookupModule will check to see whether the module can also -- be found in a package, and if so, that package Module will be -- returned. If not, the usual module-not-found error will be thrown. lookupModule :: GhcMonad m => ModuleName -> Maybe FastString -> m Module -- | Takes a ModuleName and possibly a UnitId, and consults -- the filesystem and package database to find the corresponding -- Module, using the algorithm that is used for an import -- declaration. findModule :: GhcMonad m => ModuleName -> Maybe FastString -> m Module -- | Take a rich token stream such as produced from -- getRichTokenStream and return source code almost identical to -- the original code (except for insignificant whitespace.) showRichTokenStream :: [(Located Token, String)] -> String -- | Given a source location and a StringBuffer corresponding to this -- location, return a rich token stream with the source associated to the -- tokens. addSourceToTokens :: RealSrcLoc -> StringBuffer -> [Located Token] -> [(Located Token, String)] -- | Give even more information on the source than getTokenStream -- This function allows reconstructing the source completely with -- showRichTokenStream. getRichTokenStream :: GhcMonad m => Module -> m [(Located Token, String)] -- | Return module source as token stream, including comments. -- -- The module must be in the module graph and its source must be -- available. Throws a SourceError on parse error. getTokenStream :: GhcMonad m => Module -> m [Located Token] -- | print a NamedThing, adding parentheses if the name is an -- operator. pprParenSymName :: NamedThing a => a -> SDoc dataConType :: DataCon -> Type -- | Retrieve all type and family instances in the environment, indexed by -- Name. Each name's lists will contain every instance in which -- that name is mentioned in the instance head. getNameToInstancesIndex :: GhcMonad m => [Module] -> Maybe [Module] -> m (Messages, Maybe (NameEnv ([ClsInst], [FamInst]))) -- | get the GlobalRdrEnv for a session getGRE :: GhcMonad m => m GlobalRdrEnv findGlobalAnns :: (GhcMonad m, Typeable a) => ([Word8] -> a) -> AnnTarget Name -> m [a] -- | Looks up a global name: that is, any top-level name in any visible -- module. Unlike lookupName, lookupGlobalName does not use the -- interactive context, and therefore does not require a preceding -- setContext. lookupGlobalName :: GhcMonad m => Name -> m (Maybe TyThing) isDictonaryId :: Id -> Bool modInfoModBreaks :: ModuleInfo -> ModBreaks -- | Retrieve module safe haskell mode modInfoSafe :: ModuleInfo -> SafeHaskellMode modInfoRdrEnv :: ModuleInfo -> Maybe GlobalRdrEnv modInfoIface :: ModuleInfo -> Maybe ModIface modInfoLookupName :: GhcMonad m => ModuleInfo -> Name -> m (Maybe TyThing) mkPrintUnqualifiedForModule :: GhcMonad m => ModuleInfo -> m (Maybe PrintUnqualified) modInfoIsExportedName :: ModuleInfo -> Name -> Bool -- | Returns the instances defined by the specified module. Warning: -- currently unimplemented for package modules. modInfoInstances :: ModuleInfo -> [ClsInst] modInfoExportsWithSelectors :: ModuleInfo -> [Name] modInfoExports :: ModuleInfo -> [Name] modInfoTopLevelScope :: ModuleInfo -> Maybe [Name] -- | The list of top-level entities defined in a module modInfoTyThings :: ModuleInfo -> [TyThing] -- | Request information about a loaded Module getModuleInfo :: GhcMonad m => Module -> m (Maybe ModuleInfo) getPrintUnqual :: GhcMonad m => m PrintUnqualified -- | Return the instances for the current interactive session. getInsts :: GhcMonad m => m ([ClsInst], [FamInst]) -- | Return the bindings for the current interactive session. getBindings :: GhcMonad m => m [TyThing] -- | Return True == module is loaded. isLoaded :: GhcMonad m => ModuleName -> m Bool -- | Get the module dependency graph. getModuleGraph :: GhcMonad m => m ModuleGraph -- | Like compileToCoreModule, but invokes the simplifier, so as to return -- simplified and tidied Core. compileToCoreSimplified :: GhcMonad m => FilePath -> m CoreModule -- | This is the way to get access to the Core bindings corresponding to a -- module. compileToCore parses, typechecks, and desugars the -- module, then returns the resulting Core module (consisting of the -- module name, type declarations, and function declarations) if -- successful. compileToCoreModule :: GhcMonad m => FilePath -> m CoreModule -- | Load a module. Input doesn't need to be desugared. -- -- A module must be loaded before dependent modules can be typechecked. -- This always includes generating a ModIface and, depending on -- the hscTarget, may also include code generation. -- -- This function will always cause recompilation and will always -- overwrite previous compilation results (potentially files on disk). loadModule :: (TypecheckedMod mod, GhcMonad m) => mod -> m mod -- | Desugar a typechecked module. desugarModule :: GhcMonad m => TypecheckedModule -> m DesugaredModule -- | Typecheck and rename a parsed module. -- -- Throws a SourceError if either fails. typecheckModule :: GhcMonad m => ParsedModule -> m TypecheckedModule -- | Parse a module. -- -- Throws a SourceError on parse error. parseModule :: GhcMonad m => ModSummary -> m ParsedModule -- | Return the ModSummary of a module with the given name. -- -- The module must be part of the module graph (see hsc_mod_graph -- and ModuleGraph). If this is not the case, this function will -- throw a GhcApiError. -- -- This function ignores boot modules and requires that there is only one -- non-boot module with the given name. getModSummary :: GhcMonad m => ModuleName -> m ModSummary -- | Inform GHC that the working directory has changed. GHC will flush its -- cache of module locations, since it may no longer be valid. -- -- Note: Before changing the working directory make sure all threads -- running in the same session have stopped. If you change the working -- directory, you should also unload the current program (set targets to -- empty, followed by load). workingDirectoryChanged :: GhcMonad m => m () -- | Attempts to guess what Target a string refers to. This function -- implements the --make/GHCi command-line syntax for filenames: -- -- guessTarget :: GhcMonad m => String -> Maybe Phase -> m Target -- | Remove a target removeTarget :: GhcMonad m => TargetId -> m () -- | Add another target. addTarget :: GhcMonad m => Target -> m () -- | Returns the current set of targets getTargets :: GhcMonad m => m [Target] -- | Sets the targets for this session. Each target may be a module name or -- a filename. The targets correspond to the set of root modules for the -- program/library. Unloading the current program is achieved by setting -- the current set of targets to be empty, followed by load. setTargets :: GhcMonad m => [Target] -> m () parseDynamicFlags :: MonadIO m => DynFlags -> [Located String] -> m (DynFlags, [Located String], [Warn]) -- | Get the DynFlags used to evaluate interactive expressions. getInteractiveDynFlags :: GhcMonad m => m DynFlags -- | Set the DynFlags used to evaluate interactive expressions. -- Note: this cannot be used for changes to packages. Use -- setSessionDynFlags, or setProgramDynFlags and then copy -- the pkgState into the interactive DynFlags. setInteractiveDynFlags :: GhcMonad m => DynFlags -> m () -- | Returns the program DynFlags. getProgramDynFlags :: GhcMonad m => m DynFlags -- | Set the action taken when the compiler produces a message. This can -- also be accomplished using setProgramDynFlags, but using -- setLogAction avoids invalidating the cached module graph. setLogAction :: GhcMonad m => LogAction -> m () -- | Sets the program DynFlags. Note: this invalidates the internal -- cached module graph, causing more work to be done the next time -- load is called. setProgramDynFlags :: GhcMonad m => DynFlags -> m [InstalledUnitId] -- | Updates both the interactive and program DynFlags in a Session. This -- also reads the package database (unless it has already been read), and -- prepares the compilers knowledge about packages. It can be called -- again to load new packages: just add new package flags to -- (packageFlags dflags). -- -- Returns a list of new packages that may need to be linked in using the -- dynamic linker (see linkPackages) as a result of new package -- flags. If you are not doing linking or doing static linking, you can -- ignore the list of packages returned. setSessionDynFlags :: GhcMonad m => DynFlags -> m [InstalledUnitId] -- | Initialise a GHC session. -- -- If you implement a custom GhcMonad you must call this function -- in the monad run function. It will initialise the session variable and -- clear all warnings. -- -- The first argument should point to the directory where GHC's library -- files reside. More precisely, this should be the output of ghc -- --print-libdir of the version of GHC the module using this API is -- compiled with. For portability, you should use the ghc-paths -- package, available at -- http://hackage.haskell.org/package/ghc-paths. initGhcMonad :: GhcMonad m => Maybe FilePath -> m () withCleanupSession :: GhcMonad m => m a -> m a -- | Run function for GhcT monad transformer. -- -- It initialises the GHC session and warnings via initGhcMonad. -- Each call to this function will create a new session which should not -- be shared among several threads. runGhcT :: ExceptionMonad m => Maybe FilePath -> GhcT m a -> m a -- | Run function for the Ghc monad. -- -- It initialises the GHC session and warnings via initGhcMonad. -- Each call to this function will create a new session which should not -- be shared among several threads. -- -- Any errors not handled inside the Ghc action are propagated as -- IO exceptions. runGhc :: Maybe FilePath -> Ghc a -> IO a -- | This function is no longer necessary, cleanup is now done by -- runGhc/runGhcT. defaultCleanupHandler :: ExceptionMonad m => DynFlags -> m a -> m a -- | Install some default exception handlers and run the inner computation. -- Unless you want to handle exceptions yourself, you should wrap this -- around the top level of your program. The default handlers output the -- error message(s) to stderr and exit cleanly. defaultErrorHandler :: ExceptionMonad m => FatalMessager -> FlushOut -> m a -> m a class ParsedMod m parsedSource :: ParsedMod m => m -> ParsedSource class ParsedMod m => TypecheckedMod m renamedSource :: TypecheckedMod m => m -> Maybe RenamedSource typecheckedSource :: TypecheckedMod m => m -> TypecheckedSource moduleInfo :: TypecheckedMod m => m -> ModuleInfo -- | The result of successful parsing. data ParsedModule ParsedModule :: ModSummary -> ParsedSource -> [FilePath] -> ApiAnns -> ParsedModule [pm_mod_summary] :: ParsedModule -> ModSummary [pm_parsed_source] :: ParsedModule -> ParsedSource [pm_extra_src_files] :: ParsedModule -> [FilePath] [pm_annotations] :: ParsedModule -> ApiAnns -- | The result of successful typechecking. It also contains the parser -- result. data TypecheckedModule TypecheckedModule :: ParsedModule -> Maybe RenamedSource -> TypecheckedSource -> ModuleInfo -> (TcGblEnv, ModDetails) -> TypecheckedModule [tm_parsed_module] :: TypecheckedModule -> ParsedModule [tm_renamed_source] :: TypecheckedModule -> Maybe RenamedSource [tm_typechecked_source] :: TypecheckedModule -> TypecheckedSource [tm_checked_module_info] :: TypecheckedModule -> ModuleInfo [tm_internals_] :: TypecheckedModule -> (TcGblEnv, ModDetails) -- | The result of successful desugaring (i.e., translation to core). Also -- contains all the information of a typechecked module. data DesugaredModule DesugaredModule :: TypecheckedModule -> ModGuts -> DesugaredModule [dm_typechecked_module] :: DesugaredModule -> TypecheckedModule [dm_core_module] :: DesugaredModule -> ModGuts type ParsedSource = Located HsModule GhcPs type RenamedSource = (HsGroup GhcRn, [LImportDecl GhcRn], Maybe [(LIE GhcRn, Avails)], Maybe LHsDocString) type TypecheckedSource = LHsBinds GhcTc -- | A CoreModule consists of just the fields of a ModGuts that are -- needed for the compileToCoreModule interface. data CoreModule CoreModule :: !Module -> !TypeEnv -> CoreProgram -> SafeHaskellMode -> CoreModule -- | Module name [cm_module] :: CoreModule -> !Module -- | Type environment for types declared in this module [cm_types] :: CoreModule -> !TypeEnv -- | Declarations [cm_binds] :: CoreModule -> CoreProgram -- | Safe Haskell mode [cm_safe] :: CoreModule -> SafeHaskellMode -- | Container for information about a Module. data ModuleInfo cyclicModuleErr :: [ModSummary] -> SDoc -- | Topological sort of the module graph -- -- Calculate SCCs of the module graph, possibly dropping the hi-boot -- nodes The resulting list of strongly-connected-components is in -- topologically sorted order, starting with the module(s) at the bottom -- of the dependency graph (ie compile them first) and ending with the -- ones at the top. -- -- Drop hi-boot nodes (first boolean arg)? -- -- topSortModuleGraph :: Bool -> ModuleGraph -> Maybe ModuleName -> [SCC ModSummary] -- | Try to load the program. See LoadHowMuch for the different -- modes. -- -- This function implements the core of GHC's --make mode. It -- preprocesses, compiles and loads the specified modules, avoiding -- re-compilation wherever possible. Depending on the target (see -- hscTarget) compiling and loading may result in files being -- created on disk. -- -- Calls the defaultWarnErrLogger after each compiling each -- module, whether successful or not. -- -- Throw a SourceError if errors are encountered before the actual -- compilation starts (e.g., during dependency analysis). All other -- errors are reported using the defaultWarnErrLogger. load :: GhcMonad m => LoadHowMuch -> m SuccessFlag -- | Perform a dependency analysis starting from the current targets and -- update the session with the new module graph. -- -- Dependency analysis entails parsing the import directives and -- may therefore require running certain preprocessors. -- -- Note that each ModSummary in the module graph caches its -- DynFlags. These DynFlags are determined by the -- current session DynFlags and the OPTIONS and -- LANGUAGE pragmas of the parsed module. Thus if you want -- changes to the DynFlags to take effect you need to call this -- function again. depanal :: GhcMonad m => [ModuleName] -> Bool -> m ModuleGraph -- | Describes which modules of the module graph need to be loaded. data LoadHowMuch -- | Load all targets and its dependencies. LoadAllTargets :: LoadHowMuch -- | Load only the given module and its dependencies. LoadUpTo :: ModuleName -> LoadHowMuch -- | Load only the dependencies of the given module, but not the module -- itself. LoadDependenciesOf :: ModuleName -> LoadHowMuch reconstructType :: HscEnv -> Int -> Id -> IO (Maybe Type) moduleIsBootOrNotObjectLinkable :: GhcMonad m => ModSummary -> m Bool showModule :: GhcMonad m => ModSummary -> m String -- | Compile an expression, run it and return the result as a Dynamic. dynCompileExpr :: GhcMonad m => String -> m Dynamic compileParsedExpr :: GhcMonad m => LHsExpr GhcPs -> m HValue -- | Compile a parsed expression (before renaming), run it, and deliver the -- resulting HValue. compileParsedExprRemote :: GhcMonad m => LHsExpr GhcPs -> m ForeignHValue -- | Compile an expression, run it, and deliver the resulting HValue. compileExprRemote :: GhcMonad m => String -> m ForeignHValue -- | Compile an expression, run it, and deliver the resulting HValue. compileExpr :: GhcMonad m => String -> m HValue -- | Parse an expression, the parsed expression can be further processed -- and passed to compileParsedExpr. parseExpr :: GhcMonad m => String -> m (LHsExpr GhcPs) parseInstanceHead :: GhcMonad m => String -> m Type getInstancesForType :: GhcMonad m => Type -> m [ClsInst] -- | Get the kind of a type typeKind :: GhcMonad m => Bool -> String -> m (Type, Kind) -- | Get the type of an expression Returns the type as described by -- TcRnExprMode exprType :: GhcMonad m => TcRnExprMode -> String -> m Type getDocs :: GhcMonad m => Name -> m (Either GetDocsFailure (Maybe HsDocString, Map Int HsDocString)) -- | Returns True if passed string is a declaration but not -- a splice. isDecl :: DynFlags -> String -> Bool -- | Returns True if passed string is an import declaration. isImport :: DynFlags -> String -> Bool -- | Returns True if passed string has an import declaration. hasImport :: DynFlags -> String -> Bool -- | Returns True if passed string is a statement. isStmt :: DynFlags -> String -> Bool -- | Parses a string as an identifier, and returns the list of Names -- that the identifier can refer to in the current interactive context. parseName :: GhcMonad m => String -> m [Name] -- | Returns all RdrNames in scope in the current interactive -- context, excluding any that are internally-generated. getRdrNamesInScope :: GhcMonad m => m [RdrName] -- | Returns all names in scope in the current interactive context getNamesInScope :: GhcMonad m => m [Name] -- | Looks up an identifier in the current interactive context (for :info) -- Filter the instances by the ones whose tycons (or clases resp) are in -- scope (qualified or otherwise). Otherwise we list a whole lot too -- many! The exact choice of which ones to show, and which to hide, is a -- judgement call. (see #1581) getInfo :: GhcMonad m => Bool -> Name -> m (Maybe (TyThing, Fixity, [ClsInst], [FamInst], SDoc)) -- | Returns True if the specified module is interpreted, and -- hence has its full top-level scope available. moduleIsInterpreted :: GhcMonad m => Module -> m Bool -- | Get the interactive evaluation context, consisting of a pair of the -- set of modules from which we take the full top-level scope, and the -- set of modules from which we take just the exports respectively. getContext :: GhcMonad m => m [InteractiveImport] -- | Set the interactive evaluation context. -- -- (setContext imports) sets the ic_imports field (which in turn -- determines what is in scope at the prompt) to imports, and -- constructs the ic_rn_glb_env environment to reflect it. -- -- We retain in scope all the things defined at the prompt, and kept in -- ic_tythings. (Indeed, they shadow stuff from ic_imports.) setContext :: GhcMonad m => [InteractiveImport] -> m () abandonAll :: GhcMonad m => m Bool abandon :: GhcMonad m => m Bool forward :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String) back :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String) resumeExec :: GhcMonad m => (SrcSpan -> Bool) -> SingleStep -> m ExecResult parseImportDecl :: GhcMonad m => String -> m (ImportDecl GhcPs) -- | Like runDeclsWithLocation, but takes parsed declarations as -- argument. Useful when doing preprocessing on the AST before execution, -- e.g. in GHCi (see GHCi.UI.runStmt). runParsedDecls :: GhcMonad m => [LHsDecl GhcPs] -> m [Name] -- | Run some declarations and return any user-visible names that were -- brought into scope. runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name] runDecls :: GhcMonad m => String -> m [Name] -- | Like execStmt, but takes a parsed statement as argument. Useful -- when doing preprocessing on the AST before execution, e.g. in GHCi -- (see GHCi.UI.runStmt). execStmt' :: GhcMonad m => GhciLStmt GhcPs -> String -> ExecOptions -> m ExecResult -- | Run a statement in the current interactive context. execStmt :: GhcMonad m => String -> ExecOptions -> m ExecResult -- | default ExecOptions execOptions :: ExecOptions getHistoryModule :: History -> Module getResumeContext :: GhcMonad m => m [Resume] -- | Failure modes for getDocs. data GetDocsFailure -- | nameModule_maybe returned Nothing. NameHasNoModule :: Name -> GetDocsFailure -- | True: The module was compiled. False: The module was -- :loaded. NoDocsInIface :: Module -> Bool -> GetDocsFailure -- | The Name was defined interactively. InteractiveName :: GetDocsFailure showModuleIndex :: (Int, Int) -> String dumpIfaceStats :: HscEnv -> IO () hscCompileCoreExpr' :: HscEnv -> SrcSpan -> CoreExpr -> IO ForeignHValue hscCompileCoreExpr :: HscEnv -> SrcSpan -> CoreExpr -> IO ForeignHValue hscParseIdentifier :: HscEnv -> String -> IO (Located RdrName) hscParseType :: String -> Hsc (LHsType GhcPs) hscParseStmtWithLocation :: String -> Int -> String -> Hsc (Maybe (GhciLStmt GhcPs)) hscParseExpr :: String -> Hsc (LHsExpr GhcPs) -- | Find the kind of a type, after generalisation hscKcType :: HscEnv -> Bool -> String -> IO (Type, Kind) -- | Typecheck an expression (but don't run it) hscTcExpr :: HscEnv -> TcRnExprMode -> String -> IO Type hscImport :: HscEnv -> String -> IO (ImportDecl GhcPs) -- | Load the given static-pointer table entries into the interpreter. See -- Note [Grand plan for static forms] in StaticPtrTable. hscAddSptEntries :: HscEnv -> [SptEntry] -> IO () hscParsedDecls :: HscEnv -> [LHsDecl GhcPs] -> IO ([TyThing], InteractiveContext) -- | Compile a decls hscDeclsWithLocation :: HscEnv -> String -> String -> Int -> IO ([TyThing], InteractiveContext) hscParseDeclsWithLocation :: HscEnv -> String -> Int -> String -> IO [LHsDecl GhcPs] -- | Compile a decls hscDecls :: HscEnv -> String -> IO ([TyThing], InteractiveContext) hscParsedStmt :: HscEnv -> GhciLStmt GhcPs -> IO (Maybe ([Id], ForeignHValue, FixityEnv)) -- | Compile a stmt all the way to an HValue, but don't run it -- -- We return Nothing to indicate an empty statement (or comment only), -- not a parse error. hscStmtWithLocation :: HscEnv -> String -> String -> Int -> IO (Maybe ([Id], ForeignHValue, FixityEnv)) -- | Compile a stmt all the way to an HValue, but don't run it -- -- We return Nothing to indicate an empty statement (or comment only), -- not a parse error. hscStmt :: HscEnv -> String -> IO (Maybe ([Id], ForeignHValue, FixityEnv)) hscCompileCmmFile :: HscEnv -> FilePath -> FilePath -> IO () hscInteractive :: HscEnv -> CgGuts -> ModLocation -> IO (Maybe FilePath, CompiledByteCode, [SptEntry]) -- | Compile to hard-code. hscGenHardCode :: HscEnv -> CgGuts -> ModLocation -> FilePath -> IO (FilePath, Maybe FilePath, [(ForeignSrcLang, FilePath)]) hscSimpleIface' :: TcGblEnv -> Maybe Fingerprint -> Hsc (ModIface, Maybe Fingerprint, ModDetails) hscSimplify' :: [String] -> ModGuts -> Hsc ModGuts hscSimplify :: HscEnv -> [String] -> ModGuts -> IO ModGuts -- | Return if a module is trusted and the pkgs it depends on to be -- trusted. hscGetSafe :: HscEnv -> Module -> SrcSpan -> IO (Bool, Set InstalledUnitId) -- | Check that a module is safe to import. -- -- We return True to indicate the import is safe and False otherwise -- although in the False case an exception may be thrown first. hscCheckSafe :: HscEnv -> Module -> SrcSpan -> IO Bool -- | Given a ModSummary, parses and typechecks it, returning the -- TcGblEnv resulting from type-checking. hscFileFrontEnd :: ModSummary -> Hsc TcGblEnv batchMsg :: Messager oneShotMsg :: HscEnv -> RecompileRequired -> IO () hscMaybeWriteIface :: DynFlags -> ModIface -> Maybe Fingerprint -> ModLocation -> IO () -- | Used by both OneShot and batch mode. Runs the pipeline HsSyn and Core -- parts of the pipeline. We return a interface if we already had an old -- one around and recompilation was not needed. Otherwise it will be -- created during later passes when we run the compilation pipeline. hscIncrementalCompile :: Bool -> Maybe TcGblEnv -> Maybe Messager -> HscEnv -> ModSummary -> SourceModified -> Maybe ModIface -> (Int, Int) -> IO (HscStatus, ModDetails, DynFlags) genericHscFrontend :: ModSummary -> Hsc FrontendResult -- | Make a ModDetails from the results of typechecking. Used when -- typechecking only, as opposed to full compilation. makeSimpleDetails :: HscEnv -> TcGblEnv -> IO ModDetails hscDesugar' :: ModLocation -> TcGblEnv -> Hsc ModGuts -- | Convert a typechecked module to Core hscDesugar :: HscEnv -> ModSummary -> TcGblEnv -> IO ModGuts tcRnModule' :: ModSummary -> Bool -> HsParsedModule -> Hsc TcGblEnv -- | Rename and typecheck a module, additionally returning the renamed -- syntax hscTypecheckRename :: HscEnv -> ModSummary -> HsParsedModule -> IO (TcGblEnv, RenamedStuff) hscParse' :: ModSummary -> Hsc HsParsedModule -- | parse a file, returning the abstract syntax hscParse :: HscEnv -> ModSummary -> IO HsParsedModule -- | Rename some import declarations hscRnImportDecls :: HscEnv -> [LImportDecl GhcPs] -> IO GlobalRdrEnv hscGetModuleInterface :: HscEnv -> Module -> IO ModIface hscIsGHCiMonad :: HscEnv -> String -> IO Name hscTcRnGetInfo :: HscEnv -> Name -> IO (Maybe (TyThing, Fixity, [ClsInst], [FamInst], SDoc)) hscTcRcLookupName :: HscEnv -> Name -> IO (Maybe TyThing) -- | Lookup things in the compiler's environment hscTcRnLookupRdrName :: HscEnv -> Located RdrName -> IO [Name] -- | Deal with errors and warnings returned by a compilation step -- -- In order to reduce dependencies to other parts of the compiler, -- functions outside the "main" parts of GHC return warnings and errors -- as a parameter and signal success via by wrapping the result in a -- Maybe type. This function logs the returned warnings and -- propagates errors as exceptions (of type SourceError). -- -- This function assumes the following invariants: -- --
    --
  1. If the second result indicates success (is of the form 'Just x'), -- there must be no error messages in the first result.
  2. --
  3. If there are no error messages, but the second result indicates -- failure there should be warnings in the first result. That is, if the -- action failed, it must have been due to the warnings (i.e., -- -Werror).
  4. --
ioMsgMaybe :: IO (Messages, Maybe a) -> Hsc a getHscEnv :: Hsc HscEnv newHscEnv :: DynFlags -> IO HscEnv type Messager = HscEnv -> (Int, Int) -> RecompileRequired -> ModSummary -> IO () runTcInteractive :: HscEnv -> TcRn a -> IO (Messages, Maybe a) -- | How should we infer a type? See Note [TcRnExprMode] data TcRnExprMode -- | Instantiate the type fully (:type) TM_Inst :: TcRnExprMode -- | Do not instantiate the type (:type +v) TM_NoInst :: TcRnExprMode -- | Default the type eagerly (:type +d) TM_Default :: TcRnExprMode -- | Pretty-prints a FamInst (type/data family instance) with its -- defining location. pprFamInst :: FamInst -> SDoc defaultWarnErrLogger :: WarnErrLogger -- | Print the error message and all warnings. Useful inside exception -- handlers. Clears warnings after printing. printException :: GhcMonad m => SourceError -> m () -- | Grabs the DynFlags from the Session getSessionDynFlags :: GhcMonad m => m DynFlags -- | A monad that has all the features needed by GHC API calls. -- -- In short, a GHC monad -- -- -- -- If you do not use Ghc or GhcT, make sure to call -- initGhcMonad before any call to the GHC API functions can -- occur. class (Functor m, MonadIO m, ExceptionMonad m, HasDynFlags m) => GhcMonad (m :: Type -> Type) getSession :: GhcMonad m => m HscEnv setSession :: GhcMonad m => HscEnv -> m () -- | A minimal implementation of a GhcMonad. If you need a custom -- monad, e.g., to maintain additional state consider wrapping this monad -- or using GhcT. data Ghc a -- | A monad transformer to add GHC specific features to another monad. -- -- Note that the wrapped monad must support IO and handling of -- exceptions. data GhcT (m :: Type -> Type) a -- | A function called to log warnings and errors. type WarnErrLogger = forall (m :: Type -> Type). GhcMonad m => Maybe SourceError -> m () -- | Foreign language of the phase if the phase deals with a foreign code phaseForeignLanguage :: Phase -> Maybe ForeignSrcLang extendCompleteMatchMap :: CompleteMatchMap -> [CompleteMatch] -> CompleteMatchMap mkCompleteMatchMap :: [CompleteMatch] -> CompleteMatchMap -- | Retrieve the compiled byte-code if possible. Panic if it is a -- file-based linkable byteCodeOfObject :: Unlinked -> CompiledByteCode -- | Retrieve the filename of the linkable if possible. Panic if it is a -- byte-code object nameOfObject :: Unlinked -> FilePath -- | Is this a bytecode linkable with no file on disk? isInterpretable :: Unlinked -> Bool -- | Is this an actual file on disk we can link in somehow? isObject :: Unlinked -> Bool linkableObjs :: Linkable -> [FilePath] isObjectLinkable :: Linkable -> Bool numToTrustInfo :: Word8 -> IfaceTrustInfo trustInfoToNum :: IfaceTrustInfo -> Word8 noIfaceTrustInfo :: IfaceTrustInfo setSafeMode :: SafeHaskellMode -> IfaceTrustInfo getSafeMode :: IfaceTrustInfo -> SafeHaskellMode -- | Find out if HPC is used by this module or any of the modules it -- depends upon isHpcUsed :: HpcInfo -> AnyHpcUsage emptyHpcInfo :: AnyHpcUsage -> HpcInfo showModMsg :: DynFlags -> HscTarget -> Bool -> ModSummary -> String -- | Did this ModSummary originate from a hs-boot file? isBootSummary :: ModSummary -> Bool msObjFilePath :: ModSummary -> FilePath msHiFilePath :: ModSummary -> FilePath msHsFilePath :: ModSummary -> FilePath -- | All of the (possibly) home module imports from a ModSummary; -- that is to say, each of these module names could be a home import if -- an appropriately named file existed. (This is in contrast to package -- qualified imports, which are guaranteed not to be home imports.) ms_home_imps :: ModSummary -> [Located ModuleName] -- | Like ms_home_imps, but for SOURCE imports. ms_home_srcimps :: ModSummary -> [Located ModuleName] ms_home_allimps :: ModSummary -> [ModuleName] home_imps :: [(Maybe FastString, Located ModuleName)] -> [Located ModuleName] ms_imps :: ModSummary -> [(Maybe FastString, Located ModuleName)] ms_mod_name :: ModSummary -> ModuleName ms_installed_mod :: ModSummary -> InstalledModule mkModuleGraph :: [ModSummary] -> ModuleGraph -- | Add a ModSummary to ModuleGraph. Assumes that the new ModSummary is -- not an element of the ModuleGraph. extendMG :: ModuleGraph -> ModSummary -> ModuleGraph isTemplateHaskellOrQQNonBoot :: ModSummary -> Bool emptyMG :: ModuleGraph -- | Look up a ModSummary in the ModuleGraph mgLookupModule :: ModuleGraph -> Module -> Maybe ModSummary mgElemModule :: ModuleGraph -> Module -> Bool mgModSummaries :: ModuleGraph -> [ModSummary] mgBootModules :: ModuleGraph -> ModuleSet -- | Map a function f over all the ModSummaries. To -- preserve invariants f can't change the isBoot status. mapMG :: (ModSummary -> ModSummary) -> ModuleGraph -> ModuleGraph -- | Determines whether a set of modules requires Template Haskell or Quasi -- Quotes -- -- Note that if the session's DynFlags enabled Template Haskell -- when depanal was called, then each module in the returned -- module graph will have Template Haskell enabled whether it is actually -- needed or not. needsTemplateHaskellOrQQ :: ModuleGraph -> Bool soExt :: Platform -> FilePath mkHsSOName :: Platform -> FilePath -> FilePath mkSOName :: Platform -> FilePath -> FilePath updNameCache :: IORef NameCache -> (NameCache -> (NameCache, c)) -> IO c -- | Add stats for one newly-read interface addEpsInStats :: EpsStats -> Int -> Int -> Int -> EpsStats noDependencies :: Dependencies lookupFixity :: FixityEnv -> Name -> Fixity emptyFixityEnv :: FixityEnv -- | Creates cached lookup for the mi_fix_fn field of -- ModIface mkIfaceFixCache :: [(OccName, Fixity)] -> OccName -> Maybe Fixity plusWarns :: Warnings -> Warnings -> Warnings emptyIfaceWarnCache :: OccName -> Maybe WarningTxt -- | Constructs the cache for the mi_warn_fn field of a -- ModIface mkIfaceWarnCache :: Warnings -> OccName -> Maybe WarningTxt -- | Get the Id from a TyThing if it is a id *or* data -- constructor thing. Panics otherwise tyThingId :: TyThing -> Id -- | Get the ConLike from a TyThing if it is a data -- constructor thing. Panics otherwise tyThingConLike :: TyThing -> ConLike -- | Get the DataCon from a TyThing if it is a data -- constructor thing. Panics otherwise tyThingDataCon :: TyThing -> DataCon -- | Get the CoAxiom from a TyThing if it is a coercion axiom -- thing. Panics otherwise tyThingCoAxiom :: TyThing -> CoAxiom Branched -- | Get the TyCon from a TyThing if it is a type constructor -- thing. Panics otherwise tyThingTyCon :: TyThing -> TyCon -- | As lookupType, but with a marginally easier-to-use interface if -- you have a HscEnv lookupTypeHscEnv :: HscEnv -> Name -> IO (Maybe TyThing) -- | Find the TyThing for the given Name by using all the -- resources at our disposal: the compiled modules in the -- HomePackageTable and the compiled modules in other packages -- that live in PackageTypeEnv. Note that this does NOT look up -- the TyThing in the module being compiled: you have to do that -- yourself, if desired lookupType :: DynFlags -> HomePackageTable -> PackageTypeEnv -> Name -> Maybe TyThing plusTypeEnv :: TypeEnv -> TypeEnv -> TypeEnv extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnv extendTypeEnvList :: TypeEnv -> [TyThing] -> TypeEnv extendTypeEnv :: TypeEnv -> TyThing -> TypeEnv lookupTypeEnv :: TypeEnv -> Name -> Maybe TyThing typeEnvFromEntities :: [Id] -> [TyCon] -> [FamInst] -> TypeEnv mkTypeEnvWithImplicits :: [TyThing] -> TypeEnv mkTypeEnv :: [TyThing] -> TypeEnv typeEnvClasses :: TypeEnv -> [Class] typeEnvDataCons :: TypeEnv -> [DataCon] typeEnvPatSyns :: TypeEnv -> [PatSyn] typeEnvIds :: TypeEnv -> [Id] typeEnvCoAxioms :: TypeEnv -> [CoAxiom Branched] typeEnvTyCons :: TypeEnv -> [TyCon] typeEnvElts :: TypeEnv -> [TyThing] emptyTypeEnv :: TypeEnv -- | The Names that a TyThing should bring into scope. Used to build the -- GlobalRdrEnv for the InteractiveContext. tyThingAvailInfo :: TyThing -> [AvailInfo] tyThingsTyCoVars :: [TyThing] -> TyCoVarSet -- | tyThingParent_maybe x returns (Just p) when pprTyThingInContext should -- print a declaration for p (albeit with some "..." in it) when asked to -- show x It returns the *immediate* parent. So a datacon returns its -- tycon but the tycon could be the associated type of a class, so it in -- turn might have a parent. tyThingParent_maybe :: TyThing -> Maybe TyThing -- | Returns True if there should be no interface-file declaration -- for this thing on its own: either it is built-in, or it is part of -- some other declaration, or it is generated implicitly by some other -- declaration. isImplicitTyThing :: TyThing -> Bool implicitTyConThings :: TyCon -> [TyThing] implicitClassThings :: Class -> [TyThing] -- | Determine the TyThings brought into scope by another -- TyThing other than itself. For example, Id's don't have -- any implicit TyThings as they just bring themselves into scope, but -- classes bring their dictionary datatype, type constructor and some -- selector functions into scope, just for a start! implicitTyThings :: TyThing -> [TyThing] -- | A function which only qualifies package names if necessary; but -- qualifies all other identifiers. pkgQual :: DynFlags -> PrintUnqualified -- | Creates a function for formatting packages based on two heuristics: -- (1) don't qualify if the package in question is "main", and (2) only -- qualify with a unit id if the package ID would be ambiguous. mkQualPackage :: DynFlags -> QueryQualifyPackage -- | Creates a function for formatting modules based on two heuristics: (1) -- if the module is the current module, don't qualify, and (2) if there -- is only one exposed package which exports this module, don't qualify. mkQualModule :: DynFlags -> QueryQualifyModule -- | Creates some functions that work out the best ways to format names for -- the user according to a set of heuristics. mkPrintUnqualified :: DynFlags -> GlobalRdrEnv -> PrintUnqualified substInteractiveContext :: InteractiveContext -> TCvSubst -> InteractiveContext -- | Add TyThings to the GlobalRdrEnv, earlier ones in the list shadowing -- later ones, and shadowing existing entries in the GlobalRdrEnv. icExtendGblRdrEnv :: GlobalRdrEnv -> [TyThing] -> GlobalRdrEnv setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext setInteractivePackage :: HscEnv -> HscEnv extendInteractiveContextWithIds :: InteractiveContext -> [Id] -> InteractiveContext -- | extendInteractiveContext is called with new TyThings recently defined -- to update the InteractiveContext to include them. Ids are easily -- removed when shadowed, but Classes and TyCons are not. Some work could -- be done to determine whether they are entirely shadowed, but as you -- could still have references to them (e.g. instances for classes or -- values of the type for TyCons), it's not clear whether removing them -- is even the appropriate behavior. extendInteractiveContext :: InteractiveContext -> [TyThing] -> [ClsInst] -> [FamInst] -> Maybe [Type] -> FixityEnv -> InteractiveContext -- | Get the PrintUnqualified function based on the flags and this -- InteractiveContext icPrintUnqual :: DynFlags -> InteractiveContext -> PrintUnqualified -- | This function returns the list of visible TyThings (useful for e.g. -- showBindings) icInScopeTTs :: InteractiveContext -> [TyThing] icInteractiveModule :: InteractiveContext -> Module -- | Constructs an empty InteractiveContext. emptyInteractiveContext :: DynFlags -> InteractiveContext appendStubC :: ForeignStubs -> SDoc -> ForeignStubs importedByUser :: [ImportedBy] -> [ImportedModsVal] -- | Constructs an empty ModDetails emptyModDetails :: ModDetails -- | Constructs cache for the mi_hash_fn field of a ModIface mkIfaceHashCache :: [(Fingerprint, IfaceDecl)] -> OccName -> Maybe (OccName, Fingerprint) emptyFullModIface :: Module -> ModIface emptyPartialModIface :: Module -> PartialModIface -- | Given a set of free holes, and a unit identifier, rename the free -- holes according to the instantiation of the unit identifier. For -- example, if we have A and B free, and our unit identity is -- p[A=C,B=impl:B], the renamed free holes are just C. renameFreeHoles :: UniqDSet ModuleName -> [(ModuleName, Module)] -> UniqDSet ModuleName -- | The "precise" free holes, e.g., the signatures that this -- ModIface depends on. mi_free_holes :: ModIface -> UniqDSet ModuleName -- | The semantic module for this interface; e.g., if it's a interface for -- a signature, if mi_module is p[A=A]:A, -- mi_semantic_module will be A. mi_semantic_module :: forall (a :: ModIfacePhase). ModIface_ a -> Module -- | Lookups up a (possibly cached) fixity from a ModIface. If one -- cannot be found, defaultFixity is returned instead. mi_fix :: ModIface -> OccName -> Fixity -- | Old-style accessor for whether or not the ModIface came from an -- hs-boot file. mi_boot :: ModIface -> Bool -- | Deal with gathering annotations in from all possible places and -- combining them into a single AnnEnv prepareAnnotations :: HscEnv -> Maybe ModGuts -> IO AnnEnv metaRequestAW :: Functor f => MetaHook f -> LHsExpr GhcTc -> f Serialized metaRequestD :: Functor f => MetaHook f -> LHsExpr GhcTc -> f [LHsDecl GhcPs] metaRequestT :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LHsType GhcPs) metaRequestP :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LPat GhcPs) metaRequestE :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LHsExpr GhcPs) -- | Get rules from modules "below" this one (in the dependency sense) hptRules :: HscEnv -> [(ModuleName, IsBootInterface)] -> [CoreRule] -- | Find all the instance declarations (of classes and families) from the -- Home Package Table filtered by the provided predicate function. Used -- in tcRnImports, to select the instances that are in the -- transitive closure of imports from the currently compiled module. hptInstances :: HscEnv -> (ModuleName -> Bool) -> ([ClsInst], [FamInst]) hptCompleteSigs :: HscEnv -> [CompleteMatch] -- | Find the ModIface for a Module, searching in both the -- loaded home and external package module information lookupIfaceByModule :: HomePackageTable -> PackageIfaceTable -> Module -> Maybe ModIface lookupHptByModule :: HomePackageTable -> Module -> Maybe HomeModInfo listToHpt :: [(ModuleName, HomeModInfo)] -> HomePackageTable addListToHpt :: HomePackageTable -> [(ModuleName, HomeModInfo)] -> HomePackageTable addToHpt :: HomePackageTable -> ModuleName -> HomeModInfo -> HomePackageTable delFromHpt :: HomePackageTable -> ModuleName -> HomePackageTable mapHpt :: (HomeModInfo -> HomeModInfo) -> HomePackageTable -> HomePackageTable allHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> Bool filterHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> HomePackageTable eltsHpt :: HomePackageTable -> [HomeModInfo] lookupHptDirectly :: HomePackageTable -> Unique -> Maybe HomeModInfo lookupHpt :: HomePackageTable -> ModuleName -> Maybe HomeModInfo pprHPT :: HomePackageTable -> SDoc -- | Constructs an empty PackageIfaceTable emptyPackageIfaceTable :: PackageIfaceTable -- | Constructs an empty HomePackageTable emptyHomePackageTable :: HomePackageTable pprTargetId :: TargetId -> SDoc pprTarget :: Target -> SDoc -- | Retrieve the ExternalPackageState cache. hscEPS :: HscEnv -> IO ExternalPackageState handleFlagWarnings :: DynFlags -> [Warn] -> IO () -- | Given a bag of warnings, turn them into an exception if -Werror is -- enabled, or print them out otherwise. printOrThrowWarnings :: DynFlags -> Bag WarnMsg -> IO () -- | Perform the given action and call the exception handler if the action -- throws a SourceError. See SourceError for more -- information. handleSourceError :: ExceptionMonad m => (SourceError -> m a) -> m a -> m a throwOneError :: MonadIO io => ErrMsg -> io a throwErrors :: MonadIO io => ErrorMessages -> io a mkApiErr :: DynFlags -> SDoc -> GhcApiError srcErrorMessages :: SourceError -> ErrorMessages mkSrcErr :: ErrorMessages -> SourceError runInteractiveHsc :: HscEnv -> Hsc a -> IO a mkInteractiveHscEnv :: HscEnv -> HscEnv runHsc :: HscEnv -> Hsc a -> IO a -- | Status of a compilation to hard-code data HscStatus -- | Nothing to do. HscNotGeneratingCode :: ModIface -> HscStatus -- | Nothing to do because code already exists. HscUpToDate :: ModIface -> HscStatus -- | Update boot file result. HscUpdateBoot :: ModIface -> HscStatus -- | Generate signature file (backpack) HscUpdateSig :: ModIface -> HscStatus -- | Recompile this module. HscRecomp :: CgGuts -> !ModLocation -> !PartialModIface -> !Maybe Fingerprint -> !DynFlags -> HscStatus -- | Information for the code generator. [hscs_guts] :: HscStatus -> CgGuts -- | Module info [hscs_mod_location] :: HscStatus -> !ModLocation -- | Partial interface [hscs_partial_iface] :: HscStatus -> !PartialModIface -- | Old interface hash for this compilation, if an old interface file -- exists. Pass to hscMaybeWriteIface when writing the interface -- to avoid updating the existing interface when the interface isn't -- changed. [hscs_old_iface_hash] :: HscStatus -> !Maybe Fingerprint -- | Generate final iface using this DynFlags. FIXME (osa): I don't -- understand why this is necessary, but I spent almost two days trying -- to figure this out and I couldn't .. perhaps someone who understands -- this code better will remove this later. [hscs_iface_dflags] :: HscStatus -> !DynFlags newtype Hsc a Hsc :: (HscEnv -> WarningMessages -> IO (a, WarningMessages)) -> Hsc a -- | A source error is an error that is caused by one or more errors in the -- source code. A SourceError is thrown by many functions in the -- compilation pipeline. Inside GHC these errors are merely printed via -- log_action, but API clients may treat them differently, for -- example, insert them into a list box. If you want the default -- behaviour, use the idiom: -- --
--   handleSourceError printExceptionAndWarnings $ do
--     ... api calls that may fail ...
--   
-- -- The SourceErrors error messages can be accessed via -- srcErrorMessages. This list may be empty if the compiler failed -- due to -Werror (Opt_WarnIsError). -- -- See printExceptionAndWarnings for more information on what to -- take care of when writing a custom error handler. data SourceError -- | An error thrown if the GHC API is used in an incorrect fashion. data GhcApiError -- | HscEnv is like Session, except that some of the fields are -- immutable. An HscEnv is used to compile a single module from plain -- Haskell source code (after preprocessing) to either C, assembly or -- C--. It's also used to store the dynamic linker state to allow for -- multiple linkers in the same address space. Things like the module -- graph don't change during a single compilation. -- -- Historical note: "hsc" used to be the name of the compiler binary, -- when there was a separate driver and compiler. To compile a single -- module, the driver would invoke hsc on the source code... so nowadays -- we think of hsc as the layer of the compiler that deals with compiling -- a single module. data HscEnv HscEnv :: DynFlags -> [Target] -> ModuleGraph -> InteractiveContext -> HomePackageTable -> {-# UNPACK #-} !IORef ExternalPackageState -> {-# UNPACK #-} !IORef NameCache -> {-# UNPACK #-} !IORef FinderCache -> Maybe (Module, IORef TypeEnv) -> MVar (Maybe IServ) -> DynLinker -> HscEnv -- | The dynamic flag settings [hsc_dflags] :: HscEnv -> DynFlags -- | The targets (or roots) of the current session [hsc_targets] :: HscEnv -> [Target] -- | The module graph of the current session [hsc_mod_graph] :: HscEnv -> ModuleGraph -- | The context for evaluating interactive statements [hsc_IC] :: HscEnv -> InteractiveContext -- | The home package table describes already-compiled home-package -- modules, excluding the module we are compiling right now. (In -- one-shot mode the current module is the only home-package module, so -- hsc_HPT is empty. All other modules count as "external-package" -- modules. However, even in GHCi mode, hi-boot interfaces are -- demand-loaded into the external-package table.) -- -- hsc_HPT is not mutable because we only demand-load external -- packages; the home package is eagerly loaded, module by module, by the -- compilation manager. -- -- The HPT may contain modules compiled earlier by --make but -- not actually below the current module in the dependency graph. -- -- (This changes a previous invariant: changed Jan 05.) [hsc_HPT] :: HscEnv -> HomePackageTable -- | Information about the currently loaded external packages. This is -- mutable because packages will be demand-loaded during a compilation -- run as required. [hsc_EPS] :: HscEnv -> {-# UNPACK #-} !IORef ExternalPackageState -- | As with hsc_EPS, this is side-effected by compiling to reflect -- sucking in interface files. They cache the state of external interface -- files, in effect. [hsc_NC] :: HscEnv -> {-# UNPACK #-} !IORef NameCache -- | The cached result of performing finding in the file system [hsc_FC] :: HscEnv -> {-# UNPACK #-} !IORef FinderCache -- | Used for one-shot compilation only, to initialise the -- IfGblEnv. See tcg_type_env_var for TcGblEnv. -- See also Note [hsc_type_env_var hack] [hsc_type_env_var] :: HscEnv -> Maybe (Module, IORef TypeEnv) -- | interactive server process. Created the first time it is needed. [hsc_iserv] :: HscEnv -> MVar (Maybe IServ) -- | dynamic linker. [hsc_dynLinker] :: HscEnv -> DynLinker data IServ IServ :: Pipe -> ProcessHandle -> IORef (UniqFM (Ptr ())) -> [HValueRef] -> IServ [iservPipe] :: IServ -> Pipe [iservProcess] :: IServ -> ProcessHandle [iservLookupSymbolCache] :: IServ -> IORef (UniqFM (Ptr ())) [iservPendingFrees] :: IServ -> [HValueRef] -- | A compilation target. -- -- A target may be supplied with the actual text of the module. If so, -- use this instead of the file contents (this is for use in an IDE where -- the file hasn't been saved by the user yet). data Target Target :: TargetId -> Bool -> Maybe (InputFileBuffer, UTCTime) -> Target -- | module or filename [targetId] :: Target -> TargetId -- | object code allowed? [targetAllowObjCode] :: Target -> Bool -- | Optional in-memory buffer containing the source code GHC should use -- for this target instead of reading it from disk. -- -- Since GHC version 8.10 modules which require preprocessors such as -- Literate Haskell or CPP to run are also supported. -- -- If a corresponding source file does not exist on disk this will result -- in a SourceError exception if targetId = TargetModule -- _ is used. However together with targetId = TargetFile _ -- GHC will not complain about the file missing. [targetContents] :: Target -> Maybe (InputFileBuffer, UTCTime) data TargetId -- | A module name: search for the file TargetModule :: ModuleName -> TargetId -- | A filename: preprocess & parse it to find the module name. If -- specified, the Phase indicates how to compile this file (which phase -- to start from). Nothing indicates the starting phase should be -- determined from the suffix of the filename. TargetFile :: FilePath -> Maybe Phase -> TargetId type InputFileBuffer = StringBuffer -- | Helps us find information about modules in the home package type HomePackageTable = DModuleNameEnv HomeModInfo -- | Helps us find information about modules in the imported packages type PackageIfaceTable = ModuleEnv ModIface -- | Information about modules in the package being compiled data HomeModInfo HomeModInfo :: !ModIface -> !ModDetails -> !Maybe Linkable -> HomeModInfo -- | The basic loaded interface file: every loaded module has one of these, -- even if it is imported from another package [hm_iface] :: HomeModInfo -> !ModIface -- | Extra information that has been created from the ModIface for -- the module, typically during typechecking [hm_details] :: HomeModInfo -> !ModDetails -- | The actual artifact we would like to link to access things in this -- module. -- -- hm_linkable might be Nothing: -- --
    --
  1. If this is an .hs-boot module
  2. --
  3. Temporarily during compilation if we pruned away the old linkable -- because it was out of date.
  4. --
-- -- After a complete compilation (load), all hm_linkable -- fields in the HomePackageTable will be Just. -- -- When re-linking a module (HscNoRecomp), we construct the -- HomeModInfo by building a new ModDetails from the old -- ModIface (only). [hm_linkable] :: HomeModInfo -> !Maybe Linkable -- | The supported metaprogramming result types data MetaRequest MetaE :: (LHsExpr GhcPs -> MetaResult) -> MetaRequest MetaP :: (LPat GhcPs -> MetaResult) -> MetaRequest MetaT :: (LHsType GhcPs -> MetaResult) -> MetaRequest MetaD :: ([LHsDecl GhcPs] -> MetaResult) -> MetaRequest MetaAW :: (Serialized -> MetaResult) -> MetaRequest -- | data constructors not exported to ensure correct result type data MetaResult type MetaHook (f :: Type -> Type) = MetaRequest -> LHsExpr GhcTc -> f MetaResult -- | The FinderCache maps modules to the result of searching for -- that module. It records the results of searching for modules along the -- search path. On :load, we flush the entire contents of this -- cache. type FinderCache = InstalledModuleEnv InstalledFindResult data InstalledFindResult InstalledFound :: ModLocation -> InstalledModule -> InstalledFindResult InstalledNoPackage :: InstalledUnitId -> InstalledFindResult InstalledNotFound :: [FilePath] -> Maybe InstalledUnitId -> InstalledFindResult -- | The result of searching for an imported module. -- -- NB: FindResult manages both user source-import lookups (which can -- result in Module) as well as direct imports for interfaces -- (which always result in InstalledModule). data FindResult -- | The module was found Found :: ModLocation -> Module -> FindResult -- | The requested package was not found NoPackage :: UnitId -> FindResult -- | _Error_: both in multiple packages FoundMultiple :: [(Module, ModuleOrigin)] -> FindResult -- | Not found NotFound :: [FilePath] -> Maybe UnitId -> [UnitId] -> [UnitId] -> [(UnitId, UnusablePackageReason)] -> [ModuleSuggestion] -> FindResult [fr_paths] :: FindResult -> [FilePath] [fr_pkg] :: FindResult -> Maybe UnitId [fr_mods_hidden] :: FindResult -> [UnitId] [fr_pkgs_hidden] :: FindResult -> [UnitId] [fr_unusables] :: FindResult -> [(UnitId, UnusablePackageReason)] [fr_suggestions] :: FindResult -> [ModuleSuggestion] type PartialModIface = ModIface_ 'ModIfaceCore type ModIface = ModIface_ 'ModIfaceFinal -- | Extends a PartialModIface with information which is either: * Computed -- after codegen * Or computed just before writing the iface to disk. -- (Hashes) In order to fully instantiate it. data ModIfaceBackend ModIfaceBackend :: !Fingerprint -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !WhetherHasOrphans -> !WhetherHasFamInst -> !Fingerprint -> !Fingerprint -> !OccName -> Maybe WarningTxt -> !OccName -> Maybe Fixity -> !OccName -> Maybe (OccName, Fingerprint) -> ModIfaceBackend -- | Hash of the whole interface [mi_iface_hash] :: ModIfaceBackend -> !Fingerprint -- | Hash of the ABI only [mi_mod_hash] :: ModIfaceBackend -> !Fingerprint -- | Hash of the important flags used when compiling the module, excluding -- optimisation flags [mi_flag_hash] :: ModIfaceBackend -> !Fingerprint -- | Hash of optimisation flags [mi_opt_hash] :: ModIfaceBackend -> !Fingerprint -- | Hash of hpc flags [mi_hpc_hash] :: ModIfaceBackend -> !Fingerprint -- | Hash of plugins [mi_plugin_hash] :: ModIfaceBackend -> !Fingerprint -- | Whether this module has orphans [mi_orphan] :: ModIfaceBackend -> !WhetherHasOrphans -- | Whether this module has family instances. See Note [The type family -- instance consistency story]. [mi_finsts] :: ModIfaceBackend -> !WhetherHasFamInst -- | Hash of export list [mi_exp_hash] :: ModIfaceBackend -> !Fingerprint -- | Hash for orphan rules, class and family instances combined [mi_orphan_hash] :: ModIfaceBackend -> !Fingerprint -- | Cached lookup for mi_warns [mi_warn_fn] :: ModIfaceBackend -> !OccName -> Maybe WarningTxt -- | Cached lookup for mi_fixities [mi_fix_fn] :: ModIfaceBackend -> !OccName -> Maybe Fixity -- | Cached lookup for mi_decls. The Nothing in -- mi_hash_fn means that the thing isn't in decls. It's useful to -- know that when seeing if we are up to date wrt. the old interface. The -- OccName is the parent of the name, if it has one. [mi_hash_fn] :: ModIfaceBackend -> !OccName -> Maybe (OccName, Fingerprint) -- | A ModIface plus a ModDetails summarises everything we -- know about a compiled module. The ModIface is the stuff -- *before* linking, and can be written out to an interface file. The -- 'ModDetails is after linking and can be completely recovered from just -- the ModIface. -- -- When we read an interface file, we also construct a ModIface -- from it, except that we explicitly make the mi_decls and a few -- other fields empty; as when reading we consolidate the declarations -- etc. into a number of indexed maps and environments in the -- ExternalPackageState. data ModIface_ (phase :: ModIfacePhase) ModIface :: !Module -> !Maybe Module -> !HscSource -> Dependencies -> [Usage] -> ![IfaceExport] -> !Bool -> [(OccName, Fixity)] -> Warnings -> [IfaceAnnotation] -> [IfaceDeclExts phase] -> !Maybe GlobalRdrEnv -> [IfaceClsInst] -> [IfaceFamInst] -> [IfaceRule] -> !AnyHpcUsage -> !IfaceTrustInfo -> !Bool -> [IfaceCompleteMatch] -> Maybe HsDocString -> DeclDocMap -> ArgDocMap -> !IfaceBackendExts phase -> ModIface_ (phase :: ModIfacePhase) -- | Name of the module we are for [mi_module] :: ModIface_ (phase :: ModIfacePhase) -> !Module -- | Are we a sig of another mod? [mi_sig_of] :: ModIface_ (phase :: ModIfacePhase) -> !Maybe Module -- | Boot? Signature? [mi_hsc_src] :: ModIface_ (phase :: ModIfacePhase) -> !HscSource -- | The dependencies of the module. This is consulted for -- directly-imported modules, but not for anything else (hence lazy) [mi_deps] :: ModIface_ (phase :: ModIfacePhase) -> Dependencies -- | Usages; kept sorted so that it's easy to decide whether to write a new -- iface file (changing usages doesn't affect the hash of this module) -- NOT STRICT! we read this field lazily from the interface file It is -- *only* consulted by the recompilation checker [mi_usages] :: ModIface_ (phase :: ModIfacePhase) -> [Usage] -- | Exports Kept sorted by (mod,occ), to make version comparisons easier -- Records the modules that are the declaration points for things -- exported by this module, and the OccNames of those things [mi_exports] :: ModIface_ (phase :: ModIfacePhase) -> ![IfaceExport] -- | Module required TH splices when it was compiled. This disables -- recompilation avoidance (see #481). [mi_used_th] :: ModIface_ (phase :: ModIfacePhase) -> !Bool -- | Fixities NOT STRICT! we read this field lazily from the interface file [mi_fixities] :: ModIface_ (phase :: ModIfacePhase) -> [(OccName, Fixity)] -- | Warnings NOT STRICT! we read this field lazily from the interface file [mi_warns] :: ModIface_ (phase :: ModIfacePhase) -> Warnings -- | Annotations NOT STRICT! we read this field lazily from the interface -- file [mi_anns] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceAnnotation] -- | Type, class and variable declarations The hash of an Id changes if its -- fixity or deprecations change (as well as its type of course) Ditto -- data constructors, class operations, except that the hash of the -- parent class/tycon changes [mi_decls] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceDeclExts phase] -- | Binds all the things defined at the top level in the original -- source code for this module. which is NOT the same as mi_exports, -- nor mi_decls (which may contains declarations for things not actually -- defined by the user). Used for GHCi and for inspecting the contents of -- modules via the GHC API only. -- -- (We need the source file to figure out the top-level environment, if -- we didn't compile this module from source then this field contains -- Nothing). -- -- Strictly speaking this field should live in the HomeModInfo, -- but that leads to more plumbing. [mi_globals] :: ModIface_ (phase :: ModIfacePhase) -> !Maybe GlobalRdrEnv -- | Sorted class instance [mi_insts] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceClsInst] -- | Sorted family instances [mi_fam_insts] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceFamInst] -- | Sorted rules [mi_rules] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceRule] -- | True if this program uses Hpc at any point in the program. [mi_hpc] :: ModIface_ (phase :: ModIfacePhase) -> !AnyHpcUsage -- | Safe Haskell Trust information for this module. [mi_trust] :: ModIface_ (phase :: ModIfacePhase) -> !IfaceTrustInfo -- | Do we require the package this module resides in be trusted to trust -- this module? This is used for the situation where a module is Safe (so -- doesn't require the package be trusted itself) but imports some -- trustworthy modules from its own package (which does require its own -- package be trusted). See Note [RnNames . Trust Own Package] [mi_trust_pkg] :: ModIface_ (phase :: ModIfacePhase) -> !Bool [mi_complete_sigs] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceCompleteMatch] -- | Module header. [mi_doc_hdr] :: ModIface_ (phase :: ModIfacePhase) -> Maybe HsDocString -- | Docs on declarations. [mi_decl_docs] :: ModIface_ (phase :: ModIfacePhase) -> DeclDocMap -- | Docs on arguments. [mi_arg_docs] :: ModIface_ (phase :: ModIfacePhase) -> ArgDocMap -- | Either () or ModIfaceBackend for a fully instantiated -- interface. [mi_final_exts] :: ModIface_ (phase :: ModIfacePhase) -> !IfaceBackendExts phase -- | The original names declared of a certain module that are exported type IfaceExport = AvailInfo -- | The ModDetails is essentially a cache for information in the -- ModIface for home modules only. Information relating to -- packages will be loaded into global environments in -- ExternalPackageState. data ModDetails ModDetails :: [AvailInfo] -> !TypeEnv -> ![ClsInst] -> ![FamInst] -> ![CoreRule] -> ![Annotation] -> [CompleteMatch] -> ModDetails [md_exports] :: ModDetails -> [AvailInfo] -- | Local type environment for this particular module Includes Ids, -- TyCons, PatSyns [md_types] :: ModDetails -> !TypeEnv -- | DFunIds for the instances in this module [md_insts] :: ModDetails -> ![ClsInst] [md_fam_insts] :: ModDetails -> ![FamInst] -- | Domain may include Ids from other modules [md_rules] :: ModDetails -> ![CoreRule] -- | Annotations present in this module: currently they only annotate -- things also declared in this module [md_anns] :: ModDetails -> ![Annotation] -- | Complete match pragmas for this module [md_complete_sigs] :: ModDetails -> [CompleteMatch] -- | Records the modules directly imported by a module for extracting e.g. -- usage information, and also to give better error message type ImportedMods = ModuleEnv [ImportedBy] -- | If a module was "imported" by the user, we associate it with more -- detailed usage information ImportedModsVal; a module imported -- by the system only gets used for usage information. data ImportedBy ImportedByUser :: ImportedModsVal -> ImportedBy ImportedBySystem :: ImportedBy data ImportedModsVal ImportedModsVal :: ModuleName -> SrcSpan -> IsSafeImport -> Bool -> !GlobalRdrEnv -> Bool -> ImportedModsVal -- | The name the module is imported with [imv_name] :: ImportedModsVal -> ModuleName -- | the source span of the whole import [imv_span] :: ImportedModsVal -> SrcSpan -- | whether this is a safe import [imv_is_safe] :: ImportedModsVal -> IsSafeImport -- | whether this is an "hiding" import [imv_is_hiding] :: ImportedModsVal -> Bool -- | all the things the module could provide NB. BangPattern here: -- otherwise this leaks. (#15111) [imv_all_exports] :: ImportedModsVal -> !GlobalRdrEnv -- | whether this is a qualified import [imv_qualified] :: ImportedModsVal -> Bool -- | A ModGuts is carried through the compiler, accumulating stuff as it -- goes There is only one ModGuts at any time, the one for the module -- being compiled right now. Once it is compiled, a ModIface and -- ModDetails are extracted and the ModGuts is discarded. data ModGuts ModGuts :: !Module -> HscSource -> SrcSpan -> ![AvailInfo] -> !Dependencies -> ![Usage] -> !Bool -> !GlobalRdrEnv -> !FixityEnv -> ![TyCon] -> ![ClsInst] -> ![FamInst] -> ![PatSyn] -> ![CoreRule] -> !CoreProgram -> !ForeignStubs -> ![(ForeignSrcLang, FilePath)] -> !Warnings -> [Annotation] -> [CompleteMatch] -> !HpcInfo -> !Maybe ModBreaks -> InstEnv -> FamInstEnv -> SafeHaskellMode -> Bool -> !Maybe HsDocString -> !DeclDocMap -> !ArgDocMap -> ModGuts -- | Module being compiled [mg_module] :: ModGuts -> !Module -- | Whether it's an hs-boot module [mg_hsc_src] :: ModGuts -> HscSource -- | For error messages from inner passes [mg_loc] :: ModGuts -> SrcSpan -- | What it exports [mg_exports] :: ModGuts -> ![AvailInfo] -- | What it depends on, directly or otherwise [mg_deps] :: ModGuts -> !Dependencies -- | What was used? Used for interfaces. [mg_usages] :: ModGuts -> ![Usage] -- | Did we run a TH splice? [mg_used_th] :: ModGuts -> !Bool -- | Top-level lexical environment [mg_rdr_env] :: ModGuts -> !GlobalRdrEnv -- | Fixities declared in this module. Used for creating interface files. [mg_fix_env] :: ModGuts -> !FixityEnv -- | TyCons declared in this module (includes TyCons for classes) [mg_tcs] :: ModGuts -> ![TyCon] -- | Class instances declared in this module [mg_insts] :: ModGuts -> ![ClsInst] -- | Family instances declared in this module [mg_fam_insts] :: ModGuts -> ![FamInst] -- | Pattern synonyms declared in this module [mg_patsyns] :: ModGuts -> ![PatSyn] -- | Before the core pipeline starts, contains See Note [Overall plumbing -- for rules] in Rules.hs [mg_rules] :: ModGuts -> ![CoreRule] -- | Bindings for this module [mg_binds] :: ModGuts -> !CoreProgram -- | Foreign exports declared in this module [mg_foreign] :: ModGuts -> !ForeignStubs -- | Files to be compiled with the C compiler [mg_foreign_files] :: ModGuts -> ![(ForeignSrcLang, FilePath)] -- | Warnings declared in the module [mg_warns] :: ModGuts -> !Warnings -- | Annotations declared in this module [mg_anns] :: ModGuts -> [Annotation] -- | Complete Matches [mg_complete_sigs] :: ModGuts -> [CompleteMatch] -- | Coverage tick boxes in the module [mg_hpc_info] :: ModGuts -> !HpcInfo -- | Breakpoints for the module [mg_modBreaks] :: ModGuts -> !Maybe ModBreaks -- | Class instance environment for home-package modules (including -- this one); c.f. tcg_inst_env [mg_inst_env] :: ModGuts -> InstEnv -- | Type-family instance environment for home-package modules -- (including this one); c.f. tcg_fam_inst_env [mg_fam_inst_env] :: ModGuts -> FamInstEnv -- | Safe Haskell mode [mg_safe_haskell] :: ModGuts -> SafeHaskellMode -- | Do we need to trust our own package for Safe Haskell? See Note -- [RnNames . Trust Own Package] [mg_trust_pkg] :: ModGuts -> Bool -- | Module header. [mg_doc_hdr] :: ModGuts -> !Maybe HsDocString -- | Docs on declarations. [mg_decl_docs] :: ModGuts -> !DeclDocMap -- | Docs on arguments. [mg_arg_docs] :: ModGuts -> !ArgDocMap -- | A restricted form of ModGuts for code generation purposes data CgGuts CgGuts :: !Module -> [TyCon] -> CoreProgram -> !ForeignStubs -> ![(ForeignSrcLang, FilePath)] -> ![InstalledUnitId] -> !HpcInfo -> !Maybe ModBreaks -> [SptEntry] -> CgGuts -- | Module being compiled [cg_module] :: CgGuts -> !Module -- | Algebraic data types (including ones that started life as classes); -- generate constructors and info tables. Includes newtypes, just for the -- benefit of External Core [cg_tycons] :: CgGuts -> [TyCon] -- | The tidied main bindings, including previously-implicit bindings for -- record and class selectors, and data constructor wrappers. But *not* -- data constructor workers; reason: we regard them as part of the -- code-gen of tycons [cg_binds] :: CgGuts -> CoreProgram -- | Foreign export stubs [cg_foreign] :: CgGuts -> !ForeignStubs [cg_foreign_files] :: CgGuts -> ![(ForeignSrcLang, FilePath)] -- | Dependent packages, used to generate #includes for C code gen [cg_dep_pkgs] :: CgGuts -> ![InstalledUnitId] -- | Program coverage tick box information [cg_hpc_info] :: CgGuts -> !HpcInfo -- | Module breakpoints [cg_modBreaks] :: CgGuts -> !Maybe ModBreaks -- | Static pointer table entries for static forms defined in the module. -- See Note [Grand plan for static forms] in StaticPtrTable [cg_spt_entries] :: CgGuts -> [SptEntry] -- | Foreign export stubs data ForeignStubs -- | We don't have any stubs NoStubs :: ForeignStubs -- | There are some stubs. Parameters: -- -- 1) Header file prototypes for "foreign exported" functions -- -- 2) C stubs to use when calling "foreign exported" functions ForeignStubs :: SDoc -> SDoc -> ForeignStubs -- | Interactive context, recording information about the state of the -- context in which statements are executed in a GHCi session. data InteractiveContext InteractiveContext :: DynFlags -> Int -> [InteractiveImport] -> [TyThing] -> GlobalRdrEnv -> ([ClsInst], [FamInst]) -> FixityEnv -> Maybe [Type] -> [Resume] -> Name -> Name -> Maybe FilePath -> InteractiveContext -- | The DynFlags used to evaluate interative expressions and -- statements. [ic_dflags] :: InteractiveContext -> DynFlags -- | Each GHCi stmt or declaration brings some new things into scope. We -- give them names like interactive:Ghci9.T, where the ic_index is the -- '9'. The ic_mod_index is incremented whenever we add something to -- ic_tythings See Note [The interactive package] [ic_mod_index] :: InteractiveContext -> Int -- | The GHCi top-level scope (ic_rn_gbl_env) is extended with these -- imports -- -- This field is only stored here so that the client can retrieve it with -- GHC.getContext. GHC itself doesn't use it, but does reset it to empty -- sometimes (such as before a GHC.load). The context is set with -- GHC.setContext. [ic_imports] :: InteractiveContext -> [InteractiveImport] -- | TyThings defined by the user, in reverse order of definition (ie most -- recent at the front) See Note [ic_tythings] [ic_tythings] :: InteractiveContext -> [TyThing] -- | The cached GlobalRdrEnv, built by setContext and updated -- regularly It contains everything in scope at the command line, -- including everything in ic_tythings [ic_rn_gbl_env] :: InteractiveContext -> GlobalRdrEnv -- | All instances and family instances created during this session. These -- are grabbed en masse after each update to be sure that proper -- overlapping is retained. That is, rather than re-check the overlapping -- each time we update the context, we just take the results from the -- instance code that already does that. [ic_instances] :: InteractiveContext -> ([ClsInst], [FamInst]) -- | Fixities declared in let statements [ic_fix_env] :: InteractiveContext -> FixityEnv -- | The current default types, set by a 'default' declaration [ic_default] :: InteractiveContext -> Maybe [Type] -- | The stack of breakpoint contexts [ic_resume] :: InteractiveContext -> [Resume] -- | The monad that GHCi is executing in [ic_monad] :: InteractiveContext -> Name -- | The function that is used for printing results of expressions in ghci -- and -e mode. [ic_int_print] :: InteractiveContext -> Name [ic_cwd] :: InteractiveContext -> Maybe FilePath data InteractiveImport -- | Bring the exports of a particular module (filtered by an import decl) -- into scope IIDecl :: ImportDecl GhcPs -> InteractiveImport -- | Bring into scope the entire top-level envt of of this module, -- including the things imported into it. IIModule :: ModuleName -> InteractiveImport -- | A map from Names to TyThings, constructed by -- typechecking local declarations or interface files type TypeEnv = NameEnv TyThing -- | Class that abstracts out the common ability of the monads in GHC to -- lookup a TyThing in the monadic environment by Name. -- Provides a number of related convenience functions for accessing -- particular kinds of TyThing class Monad m => MonadThings (m :: Type -> Type) lookupThing :: MonadThings m => Name -> m TyThing lookupId :: MonadThings m => Name -> m Id lookupDataCon :: MonadThings m => Name -> m DataCon lookupTyCon :: MonadThings m => Name -> m TyCon -- | Warning information for a module data Warnings -- | Nothing deprecated NoWarnings :: Warnings -- | Whole module deprecated WarnAll :: WarningTxt -> Warnings -- | Some specific things deprecated WarnSome :: [(OccName, WarningTxt)] -> Warnings -- | Fixity environment mapping names to their fixities type FixityEnv = NameEnv FixItem -- | Fixity information for an Name. We keep the OccName in the -- range so that we can generate an interface from it data FixItem FixItem :: OccName -> Fixity -> FixItem -- | Records whether a module has orphans. An "orphan" is one of: -- -- type WhetherHasOrphans = Bool -- | Did this module originate from a *-boot file? type IsBootInterface = Bool -- | Dependency information about ALL modules and packages below this one -- in the import hierarchy. -- -- Invariant: the dependencies of a module M never includes -- M. -- -- Invariant: none of the lists contain duplicates. data Dependencies Deps :: [(ModuleName, IsBootInterface)] -> [(InstalledUnitId, Bool)] -> [Module] -> [Module] -> [ModuleName] -> Dependencies -- | All home-package modules transitively below this one I.e. modules that -- this one imports, or that are in the dep_mods of those -- directly-imported modules [dep_mods] :: Dependencies -> [(ModuleName, IsBootInterface)] -- | All packages transitively below this module I.e. packages to which -- this module's direct imports belong, or that are in the dep_pkgs of -- those modules The bool indicates if the package is required to be -- trusted when the module is imported as a safe import (Safe Haskell). -- See Note [RnNames . Tracking Trust Transitively] [dep_pkgs] :: Dependencies -> [(InstalledUnitId, Bool)] -- | Transitive closure of orphan modules (whether home or external pkg). -- -- (Possible optimization: don't include family instance orphans as they -- are anyway included in dep_finsts. But then be careful about -- code which relies on dep_orphs having the complete list!) This does -- NOT include us, unlike imp_orphs. [dep_orphs] :: Dependencies -> [Module] -- | Transitive closure of depended upon modules which contain family -- instances (whether home or external). This is used by -- checkFamInstConsistency. This does NOT include us, unlike -- imp_finsts. See Note [The type family instance consistency -- story]. [dep_finsts] :: Dependencies -> [Module] -- | All the plugins used while compiling this module. [dep_plgins] :: Dependencies -> [ModuleName] -- | Records modules for which changes may force recompilation of this -- module See wiki: -- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/recompilation-avoidance -- -- This differs from Dependencies. A module X may be in the dep_mods of -- this module (via an import chain) but if we don't use anything from X -- it won't appear in our Usage data Usage -- | Module from another package UsagePackageModule :: Module -> Fingerprint -> IsSafeImport -> Usage -- | External package module depended on [usg_mod] :: Usage -> Module -- | Cached module fingerprint [usg_mod_hash] :: Usage -> Fingerprint -- | Was this module imported as a safe import [usg_safe] :: Usage -> IsSafeImport -- | Module from the current package | A file upon which the module -- depends, e.g. a CPP #include, or using TH's addDependentFile UsageHomeModule :: ModuleName -> Fingerprint -> [(OccName, Fingerprint)] -> Maybe Fingerprint -> IsSafeImport -> Usage -- | Name of the module [usg_mod_name] :: Usage -> ModuleName -- | Cached module fingerprint [usg_mod_hash] :: Usage -> Fingerprint -- | Entities we depend on, sorted by occurrence name and fingerprinted. -- NB: usages are for parent names only, e.g. type constructors but not -- the associated data constructors. [usg_entities] :: Usage -> [(OccName, Fingerprint)] -- | Fingerprint for the export list of this module, if we directly -- imported it (and hence we depend on its export list) [usg_exports] :: Usage -> Maybe Fingerprint -- | Was this module imported as a safe import [usg_safe] :: Usage -> IsSafeImport UsageFile :: FilePath -> Fingerprint -> Usage -- | External file dependency. From a CPP #include or TH addDependentFile. -- Should be absolute. [usg_file_path] :: Usage -> FilePath -- | Fingerprint of the file contents. [usg_file_hash] :: Usage -> Fingerprint -- | A requirement which was merged into this one. UsageMergedRequirement :: Module -> Fingerprint -> Usage -- | External package module depended on [usg_mod] :: Usage -> Module -- | Cached module fingerprint [usg_mod_hash] :: Usage -> Fingerprint type PackageTypeEnv = TypeEnv type PackageRuleBase = RuleBase type PackageInstEnv = InstEnv type PackageFamInstEnv = FamInstEnv type PackageCompleteMatchMap = CompleteMatchMap -- | Information about other packages that we have slurped in by reading -- their interface files data ExternalPackageState EPS :: !ModuleNameEnv (ModuleName, IsBootInterface) -> !PackageIfaceTable -> InstalledModuleEnv (UniqDSet ModuleName) -> !PackageTypeEnv -> !PackageInstEnv -> !PackageFamInstEnv -> !PackageRuleBase -> !PackageAnnEnv -> !PackageCompleteMatchMap -> !ModuleEnv FamInstEnv -> !EpsStats -> ExternalPackageState -- | In OneShot mode (only), home-package modules accumulate in the -- external package state, and are sucked in lazily. For these home-pkg -- modules (only) we need to record which are boot modules. We set this -- field after loading all the explicitly-imported interfaces, but before -- doing anything else -- -- The ModuleName part is not necessary, but it's useful for debug -- prints, and it's convenient because this field comes direct from -- imp_dep_mods [eps_is_boot] :: ExternalPackageState -> !ModuleNameEnv (ModuleName, IsBootInterface) -- | The ModIfaces for modules in external packages whose interfaces -- we have opened. The declarations in these interface files are held in -- the eps_decls, eps_inst_env, eps_fam_inst_env -- and eps_rules fields of this record, not in the -- mi_decls fields of the interface we have sucked in. -- -- What is in the PIT is: -- -- [eps_PIT] :: ExternalPackageState -> !PackageIfaceTable -- | Cache for mi_free_holes. Ordinarily, we can rely on the -- eps_PIT for this information, EXCEPT that when we do dependency -- analysis, we need to look at the Dependencies of our imports to -- determine what their precise free holes are -- (moduleFreeHolesPrecise). We don't want to repeatedly reread -- in the interface for every import, so cache it here. When the PIT gets -- filled in we can drop these entries. [eps_free_holes] :: ExternalPackageState -> InstalledModuleEnv (UniqDSet ModuleName) -- | Result of typechecking all the external package interface files we -- have sucked in. The domain of the mapping is external-package modules [eps_PTE] :: ExternalPackageState -> !PackageTypeEnv -- | The total InstEnv accumulated from all the external-package -- modules [eps_inst_env] :: ExternalPackageState -> !PackageInstEnv -- | The total FamInstEnv accumulated from all the external-package -- modules [eps_fam_inst_env] :: ExternalPackageState -> !PackageFamInstEnv -- | The total RuleEnv accumulated from all the external-package -- modules [eps_rule_base] :: ExternalPackageState -> !PackageRuleBase -- | The total AnnEnv accumulated from all the external-package -- modules [eps_ann_env] :: ExternalPackageState -> !PackageAnnEnv -- | The total CompleteMatchMap accumulated from all the -- external-package modules [eps_complete_matches] :: ExternalPackageState -> !PackageCompleteMatchMap -- | The family instances accumulated from external packages, keyed off the -- module that declared them [eps_mod_fam_inst_env] :: ExternalPackageState -> !ModuleEnv FamInstEnv -- | Stastics about what was loaded from external packages [eps_stats] :: ExternalPackageState -> !EpsStats -- | Accumulated statistics about what we are putting into the -- ExternalPackageState. "In" means stuff that is just read -- from interface files, "Out" means actually sucked in and type-checked data EpsStats EpsStats :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> EpsStats [n_ifaces_in] :: EpsStats -> !Int [n_decls_in] :: EpsStats -> !Int [n_decls_out] :: EpsStats -> !Int [n_rules_in] :: EpsStats -> !Int [n_rules_out] :: EpsStats -> !Int [n_insts_in] :: EpsStats -> !Int [n_insts_out] :: EpsStats -> !Int -- | A ModuleGraph contains all the nodes from the home package (only). -- There will be a node for each source module, plus a node for each -- hi-boot module. -- -- The graph is not necessarily stored in topologically-sorted order. Use -- topSortModuleGraph and flattenSCC to achieve this. data ModuleGraph -- | A single node in a ModuleGraph. The nodes of the module graph -- are one of: -- -- data ModSummary ModSummary :: Module -> HscSource -> ModLocation -> UTCTime -> Maybe UTCTime -> Maybe UTCTime -> Maybe UTCTime -> [(Maybe FastString, Located ModuleName)] -> [(Maybe FastString, Located ModuleName)] -> Maybe HsParsedModule -> FilePath -> DynFlags -> Maybe StringBuffer -> ModSummary -- | Identity of the module [ms_mod] :: ModSummary -> Module -- | The module source either plain Haskell or hs-boot [ms_hsc_src] :: ModSummary -> HscSource -- | Location of the various files belonging to the module [ms_location] :: ModSummary -> ModLocation -- | Timestamp of source file [ms_hs_date] :: ModSummary -> UTCTime -- | Timestamp of object, if we have one [ms_obj_date] :: ModSummary -> Maybe UTCTime -- | Timestamp of hi file, if we *only* are typechecking (it is -- Nothing otherwise. See Note [Recompilation checking in -- -fno-code mode] and #9243 [ms_iface_date] :: ModSummary -> Maybe UTCTime -- | Timestamp of hie file, if we have one [ms_hie_date] :: ModSummary -> Maybe UTCTime -- | Source imports of the module [ms_srcimps] :: ModSummary -> [(Maybe FastString, Located ModuleName)] -- | Non-source imports of the module from the module *text* [ms_textual_imps] :: ModSummary -> [(Maybe FastString, Located ModuleName)] -- | The parsed, nonrenamed source, if we have it. This is also used to -- support "inline module syntax" in Backpack files. [ms_parsed_mod] :: ModSummary -> Maybe HsParsedModule -- | Filename of preprocessed source file [ms_hspp_file] :: ModSummary -> FilePath -- | Cached flags from OPTIONS, INCLUDE and -- LANGUAGE pragmas in the modules source code [ms_hspp_opts] :: ModSummary -> DynFlags -- | The actual preprocessed source, if we have it [ms_hspp_buf] :: ModSummary -> Maybe StringBuffer -- | Indicates whether a given module's source has been modified since it -- was last compiled. data SourceModified -- | the source has been modified SourceModified :: SourceModified -- | the source has not been modified. Compilation may or may not be -- necessary, depending on whether any dependencies have changed since we -- last compiled. SourceUnmodified :: SourceModified -- | the source has not been modified, and furthermore all of its -- (transitive) dependencies are up to date; it definitely does not need -- to be recompiled. This is important for two reasons: (a) we can omit -- the version check in checkOldIface, and (b) if the module used TH -- splices we don't need to force recompilation. SourceUnmodifiedAndStable :: SourceModified -- | Information about a modules use of Haskell Program Coverage data HpcInfo HpcInfo :: Int -> Int -> HpcInfo [hpcInfoTickCount] :: HpcInfo -> Int [hpcInfoHash] :: HpcInfo -> Int NoHpcInfo :: AnyHpcUsage -> HpcInfo -- | Is hpc used anywhere on the module *tree*? [hpcUsed] :: HpcInfo -> AnyHpcUsage -- | This is used to signal if one of my imports used HPC instrumentation -- even if there is no module-local HPC usage type AnyHpcUsage = Bool -- | Is an import a safe import? type IsSafeImport = Bool -- | Safe Haskell information for ModIface Simply a wrapper around -- SafeHaskellMode to sepperate iface and flags data IfaceTrustInfo data HsParsedModule HsParsedModule :: Located (HsModule GhcPs) -> [FilePath] -> ApiAnns -> HsParsedModule [hpm_module] :: HsParsedModule -> Located (HsModule GhcPs) -- | extra source files (e.g. from #includes). The lexer collects these -- from '# file line' pragmas, which the C preprocessor -- leaves behind. These files and their timestamps are stored in the .hi -- file, so that we can force recompilation if any of them change (#3589) [hpm_src_files] :: HsParsedModule -> [FilePath] [hpm_annotations] :: HsParsedModule -> ApiAnns -- | A list of conlikes which represents a complete pattern match. These -- arise from COMPLETE signatures. data CompleteMatch CompleteMatch :: [Name] -> Name -> CompleteMatch -- | The ConLikes that form a covering family (e.g. Nothing, Just) [completeMatchConLikes] :: CompleteMatch -> [Name] -- | The TyCon that they cover (e.g. Maybe) [completeMatchTyCon] :: CompleteMatch -> Name -- | A map keyed by the completeMatchTyCon. type CompleteMatchMap = UniqFM [CompleteMatch] -- | Haskell Module -- -- All we actually declare here is the top-level structure for a module. data HsModule pass -- | AnnKeywordIds -- -- HsModule :: Maybe (Located ModuleName) -> Maybe (Located [LIE pass]) -> [LImportDecl pass] -> [LHsDecl pass] -> Maybe (Located WarningTxt) -> Maybe LHsDocString -> HsModule pass -- | Nothing: "module X where" is omitted (in which case the next -- field is Nothing too) [hsmodName] :: HsModule pass -> Maybe (Located ModuleName) -- | Export list -- -- [hsmodExports] :: HsModule pass -> Maybe (Located [LIE pass]) -- | We snaffle interesting stuff out of the imported interfaces early on, -- adding that info to TyDecls/etc; so this list is often empty, -- downstream. [hsmodImports] :: HsModule pass -> [LImportDecl pass] -- | Type, class, value, and interface signature decls [hsmodDecls] :: HsModule pass -> [LHsDecl pass] -- | reason/explanation for warning/deprecation of this module -- -- [hsmodDeprecMessage] :: HsModule pass -> Maybe (Located WarningTxt) -- | Haddock module info and description, unparsed -- -- [hsmodHaddockModHeader] :: HsModule pass -> Maybe LHsDocString lPatImplicits :: LPat GhcRn -> [(SrcSpan, [Name])] hsValBindsImplicits :: forall (idR :: Pass). HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])] lStmtsImplicits :: forall (idR :: Pass) body. [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))] -> [(SrcSpan, [Name])] -- | the SrcLoc returned are for the whole declarations, not just the names hsDataFamInstBinders :: forall (p :: Pass). DataFamInstDecl (GhcPass p) -> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)]) getPatSynBinds :: [(RecFlag, LHsBinds id)] -> [PatSynBind id id] -- | Collects record pattern-synonym selectors only; the pattern synonym -- names are collected by collectHsValBinders. hsPatSynSelectors :: forall (p :: Pass). HsValBinds (GhcPass p) -> [IdP (GhcPass p)] -- | See Note [SrcSpan for binders] hsForeignDeclsBinders :: [LForeignDecl pass] -> [Located (IdP pass)] -- | Returns all the binding names of the decl. The first one is -- guaranteed to be the name of the decl. The first component represents -- all binding names except record fields; the second represents field -- occurrences. For record fields mentioned in multiple constructors, the -- SrcLoc will be from the first occurrence. -- -- Each returned (Located name) has a SrcSpan for the whole -- declaration. See Note [SrcSpan for binders] hsLTyClDeclBinders :: forall (p :: Pass). Located (TyClDecl (GhcPass p)) -> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)]) hsTyClForeignBinders :: [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name] hsGroupBinders :: HsGroup GhcRn -> [Name] collectPatsBinders :: forall (p :: Pass). [LPat (GhcPass p)] -> [IdP (GhcPass p)] collectPatBinders :: forall (p :: Pass). LPat (GhcPass p) -> [IdP (GhcPass p)] collectStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)] collectLStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)] collectStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)] collectLStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)] -- | Used exclusively for the bindings of an instance decl which are all -- FunBinds collectMethodBinders :: LHsBindsLR idL idR -> [Located (IdP idL)] -- | Same as collectHsBindsBinders, but works over a list of bindings collectHsBindListBinders :: forall (p :: Pass) idR. [LHsBindLR (GhcPass p) idR] -> [IdP (GhcPass p)] collectHsBindsBinders :: forall (p :: Pass) idR. LHsBindsLR (GhcPass p) idR -> [IdP (GhcPass p)] -- | Collect both Ids and pattern-synonym binders collectHsBindBinders :: (SrcSpanLess (LPat p) ~ Pat p, HasSrcSpan (LPat p)) => HsBindLR p idR -> [IdP p] -- | Collect Id binders only, or Ids + pattern synonyms, respectively collectHsValBinders :: forall (idL :: Pass) (idR :: Pass). HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] -- | Collect Id binders only, or Ids + pattern synonyms, respectively collectHsIdBinders :: forall (idL :: Pass) (idR :: Pass). HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] collectLocalBinders :: forall (idL :: Pass) (idR :: Pass). HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] -- | Is a binding a strict variable or pattern bind (e.g. !x = -- ...)? isBangedHsBind :: HsBind GhcTc -> Bool -- | Should we treat this as an unlifted bind? This will be true for any -- bind that binds an unlifted variable, but we must be careful around -- AbsBinds. See Note [Unlifted id check in isUnliftedHsBind]. For usage -- information, see Note [Strict binds check] is DsBinds. isUnliftedHsBind :: HsBind GhcTc -> Bool mkMatch :: forall (p :: Pass). HsMatchContext (NameOrRdrName (IdP (GhcPass p))) -> [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> Located (HsLocalBinds (GhcPass p)) -> LMatch (GhcPass p) (LHsExpr (GhcPass p)) -- | Make a prefix, non-strict function HsMatchContext mkPrefixFunRhs :: Located id -> HsMatchContext id -- | Convenience function using mkFunBind. This is for generated -- bindings only, do not use for user-written code. mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> [LPat GhcPs] -> LHsExpr GhcPs -> LHsBind GhcPs -- | If any of the matches in the FunBind are infix, the -- FunBind is considered infix. isInfixFunBind :: HsBindLR id1 id2 -> Bool mkPatSynBind :: Located RdrName -> HsPatSynDetails (Located RdrName) -> LPat GhcPs -> HsPatSynDir GhcPs -> HsBind GhcPs mkVarBind :: forall (p :: Pass). IdP (GhcPass p) -> LHsExpr (GhcPass p) -> LHsBind (GhcPass p) mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs -- | In Name-land, with empty bind_fvs mkTopFunBind :: Origin -> Located Name -> [LMatch GhcRn (LHsExpr GhcRn)] -> HsBind GhcRn -- | Not infix, with place holders for coercion and free vars mkFunBind :: Origin -> Located RdrName -> [LMatch GhcPs (LHsExpr GhcPs)] -> HsBind GhcPs mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc mkHsWrapPatCo :: forall (id :: Pass). TcCoercionN -> Pat (GhcPass id) -> Type -> Pat (GhcPass id) mkHsWrapPat :: forall (id :: Pass). HsWrapper -> Pat (GhcPass id) -> Type -> Pat (GhcPass id) mkLHsCmdWrap :: forall (p :: Pass). HsWrapper -> LHsCmd (GhcPass p) -> LHsCmd (GhcPass p) mkHsCmdWrap :: forall (p :: Pass). HsWrapper -> HsCmd (GhcPass p) -> HsCmd (GhcPass p) mkLHsWrapCo :: forall (id :: Pass). TcCoercionN -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) mkHsWrapCoR :: forall (id :: Pass). TcCoercionR -> HsExpr (GhcPass id) -> HsExpr (GhcPass id) mkHsWrapCo :: forall (id :: Pass). TcCoercionN -> HsExpr (GhcPass id) -> HsExpr (GhcPass id) -- | Avoid (HsWrap co (HsWrap co' _)). See Note [Detecting forced eta -- expansion] in DsExpr mkHsWrap :: forall (id :: Pass). HsWrapper -> HsExpr (GhcPass id) -> HsExpr (GhcPass id) mkLHsWrap :: forall (id :: Pass). HsWrapper -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -- | Converting a Type to an HsType RdrName This is needed to implement -- GeneralizedNewtypeDeriving. -- -- Note that we use getRdrName extensively, which generates Exact -- RdrNames rather than strings. typeToLHsType :: Type -> LHsType GhcPs -- | Convert TypeSig to ClassOpSig The former is what is parsed, but the -- latter is what we need in class/instance declarations mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs] mkHsSigEnv :: (LSig GhcRn -> Maybe ([Located Name], a)) -> [LSig GhcRn] -> NameEnv a mkLHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs mkLHsSigType :: LHsType GhcPs -> LHsSigType GhcPs -- | Split a list into lists that are small enough to have a corresponding -- tuple arity. The sub-lists of the result all have length <= -- mAX_TUPLE_SIZE But there may be more than mAX_TUPLE_SIZE -- sub-lists chunkify :: [a] -> [[a]] -- | Lifts a "small" constructor into a "big" constructor by recursive -- decompositon mkChunkified :: ([a] -> a) -> [a] -> a mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn -- | The Big equivalents for the source tuple patterns mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn mkBigLHsTup :: forall (id :: Pass). [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) -- | The Big equivalents for the source tuple expressions mkBigLHsVarTup :: forall (id :: Pass). [IdP (GhcPass id)] -> LHsExpr (GhcPass id) missingTupArg :: HsTupArg GhcPs nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs mkLHsVarTuple :: forall (a :: Pass). [IdP (GhcPass a)] -> LHsExpr (GhcPass a) mkLHsTupleExpr :: forall (a :: Pass). [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a) nlHsAppKindTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p) nlHsTyConApp :: forall (p :: Pass). IdP (GhcPass p) -> [LHsType (GhcPass p)] -> LHsType (GhcPass p) nlHsParTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) nlHsFunTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) nlHsTyVar :: forall (p :: Pass). IdP (GhcPass p) -> LHsType (GhcPass p) nlHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs -- | Note [Rebindable nlHsIf] nlHsIf should generate if-expressions which -- are NOT subject to RebindableSyntax, so the first field of HsIf is -- Nothing. (#12080) nlHsIf :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) nlHsPar :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs nlHsDo :: HsStmtContext Name -> [LStmt GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs -- | Wildcard pattern - after renaming nlWildPatName :: LPat GhcRn -- | Wildcard pattern - after parsing nlWildPat :: LPat GhcPs nlWildConPat :: DataCon -> LPat GhcPs nlNullaryConPat :: forall (p :: Pass). IdP (GhcPass p) -> LPat (GhcPass p) nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs nlInfixConPat :: RdrName -> LPat GhcPs -> LPat GhcPs -> LPat GhcPs nlConVarPatName :: Name -> [Name] -> LPat GhcRn nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs nlHsVarApps :: forall (id :: Pass). IdP (GhcPass id) -> [IdP (GhcPass id)] -> LHsExpr (GhcPass id) nlHsApps :: forall (id :: Pass). IdP (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) nlHsSyntaxApps :: forall (id :: Pass). SyntaxExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) nlHsApp :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) nlLitPat :: HsLit GhcPs -> LPat GhcPs nlVarPat :: forall (id :: Pass). IdP (GhcPass id) -> LPat (GhcPass id) nlHsIntLit :: forall (p :: Pass). Integer -> LHsExpr (GhcPass p) nlHsLit :: forall (p :: Pass). HsLit (GhcPass p) -> LHsExpr (GhcPass p) -- | NB: Only for LHsExpr **Id** nlHsDataCon :: DataCon -> LHsExpr GhcTc nlHsVar :: forall (id :: Pass). IdP (GhcPass id) -> LHsExpr (GhcPass id) mkHsStringPrimLit :: forall (p :: Pass). FastString -> HsLit (GhcPass p) mkHsString :: forall (p :: Pass). String -> HsLit (GhcPass p) unqualQuasiQuote :: RdrName mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice GhcPs mkTypedSplice :: SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs mkUntypedSplice :: SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs -- | A useful function for building OpApps. The operator is always -- a variable, and we don't know the fixity yet. mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs mkRecStmt :: forall (idL :: Pass) bodyR. [LStmtLR (GhcPass idL) GhcPs bodyR] -> StmtLR (GhcPass idL) GhcPs bodyR emptyRecStmtId :: StmtLR GhcTc GhcTc bodyR emptyRecStmtName :: StmtLR GhcRn GhcRn bodyR emptyRecStmt :: forall (idL :: Pass) bodyR. StmtLR (GhcPass idL) GhcPs bodyR unitRecStmtTc :: RecStmtTc mkTcBindStmt :: LPat GhcTc -> Located (bodyR GhcTc) -> StmtLR GhcTc GhcTc (Located (bodyR GhcTc)) mkBindStmt :: forall (idL :: Pass) (idR :: Pass) bodyR. XBindStmt (GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR))) ~ NoExtField => LPat (GhcPass idL) -> Located (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR))) mkBodyStmt :: forall bodyR (idL :: Pass). Located (bodyR GhcPs) -> StmtLR (GhcPass idL) GhcPs (Located (bodyR GhcPs)) mkLastStmt :: forall bodyR (idR :: Pass) (idL :: Pass). Located (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR))) mkGroupByUsingStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) mkGroupUsingStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) mkTransformByStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) mkTransformStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) emptyTransStmt :: StmtLR GhcPs GhcPs (LHsExpr GhcPs) mkNPlusKPat :: Located RdrName -> Located (HsOverLit GhcPs) -> Pat GhcPs mkNPat :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> Pat GhcPs mkHsCmdIf :: forall (p :: Pass). LHsExpr (GhcPass p) -> LHsCmd (GhcPass p) -> LHsCmd (GhcPass p) -> HsCmd (GhcPass p) mkHsIf :: forall (p :: Pass). LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -> HsExpr (GhcPass p) mkHsComp :: HsStmtContext Name -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs mkHsDo :: HsStmtContext Name -> [ExprLStmt GhcPs] -> HsExpr GhcPs mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs mkHsFractional :: FractionalLit -> HsOverLit GhcPs mkHsIntegral :: IntegralLit -> HsOverLit GhcPs nlParPat :: forall (name :: Pass). LPat (GhcPass name) -> LPat (GhcPass name) mkParPat :: forall (name :: Pass). LPat (GhcPass name) -> LPat (GhcPass name) -- | Wrap in parens if (hsExprNeedsParens appPrec) says it needs them So 'f -- x' becomes '(f x)', but '3' stays as '3' mkLHsPar :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) nlHsTyApps :: forall (id :: Pass). IdP (GhcPass id) -> [Type] -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) nlHsTyApp :: forall (id :: Pass). IdP (GhcPass id) -> [Type] -> LHsExpr (GhcPass id) -- | A simple case alternative with a single pattern, no binds, no guards; -- pre-typechecking mkHsCaseAlt :: forall (p :: Pass) body. LPat (GhcPass p) -> Located (body (GhcPass p)) -> LMatch (GhcPass p) (Located (body (GhcPass p))) mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc mkHsLam :: forall (p :: Pass). XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField => [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn mkHsAppType :: forall (id :: Pass). NoGhcTc (GhcPass id) ~ GhcRn => LHsExpr (GhcPass id) -> LHsWcType GhcRn -> LHsExpr (GhcPass id) mkHsApp :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) mkMatchGroup :: XMG name (Located (body name)) ~ NoExtField => Origin -> [LMatch name (Located (body name))] -> MatchGroup name (Located (body name)) unguardedRHS :: forall body (p :: Pass). SrcSpan -> Located (body (GhcPass p)) -> [LGRHS (GhcPass p) (Located (body (GhcPass p)))] unguardedGRHSs :: forall body (p :: Pass). Located (body (GhcPass p)) -> GRHSs (GhcPass p) (Located (body (GhcPass p))) mkSimpleMatch :: forall (p :: Pass) body. HsMatchContext (NameOrRdrName (IdP (GhcPass p))) -> [LPat (GhcPass p)] -> Located (body (GhcPass p)) -> LMatch (GhcPass p) (Located (body (GhcPass p))) -- | e => (e) mkHsPar :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) pprStmtInCtxt :: forall (idL :: Pass) (idR :: Pass) body. (OutputableBndrId idL, OutputableBndrId idR, Outputable body) => HsStmtContext (IdP (GhcPass idL)) -> StmtLR (GhcPass idL) (GhcPass idR) body -> SDoc pprMatchInCtxt :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable (NameOrRdrName (NameOrRdrName (IdP (GhcPass idR)))), Outputable body) => Match (GhcPass idR) body -> SDoc matchContextErrString :: Outputable id => HsMatchContext id -> SDoc pprStmtContext :: (Outputable id, Outputable (NameOrRdrName id)) => HsStmtContext id -> SDoc pprAStmtContext :: (Outputable id, Outputable (NameOrRdrName id)) => HsStmtContext id -> SDoc pprMatchContextNoun :: (Outputable (NameOrRdrName id), Outputable id) => HsMatchContext id -> SDoc pprMatchContext :: (Outputable (NameOrRdrName id), Outputable id) => HsMatchContext id -> SDoc matchSeparator :: HsMatchContext id -> SDoc isMonadCompContext :: HsStmtContext id -> Bool -- | Should pattern match failure in a HsStmtContext be desugared -- using MonadFail? isMonadFailStmtContext :: HsStmtContext id -> Bool isComprehensionContext :: HsStmtContext id -> Bool isPatSynCtxt :: HsMatchContext id -> Bool pp_dotdot :: SDoc thTyBrackets :: SDoc -> SDoc thBrackets :: SDoc -> SDoc -> SDoc pprHsBracket :: forall (p :: Pass). OutputableBndrId p => HsBracket (GhcPass p) -> SDoc isTypedBracket :: HsBracket id -> Bool ppr_splice :: forall (p :: Pass). OutputableBndrId p => SDoc -> IdP (GhcPass p) -> LHsExpr (GhcPass p) -> SDoc -> SDoc ppr_quasi :: OutputableBndr p => p -> p -> FastString -> SDoc ppr_splice_decl :: forall (p :: Pass). OutputableBndrId p => HsSplice (GhcPass p) -> SDoc pprPendingSplice :: forall (p :: Pass). OutputableBndrId p => SplicePointName -> LHsExpr (GhcPass p) -> SDoc isTypedSplice :: HsSplice id -> Bool pprQuals :: forall (p :: Pass) body. (OutputableBndrId p, Outputable body) => [LStmt (GhcPass p) body] -> SDoc pprComp :: forall (p :: Pass) body. (OutputableBndrId p, Outputable body) => [LStmt (GhcPass p) body] -> SDoc ppr_do_stmts :: forall (idL :: Pass) (idR :: Pass) body. (OutputableBndrId idL, OutputableBndrId idR, Outputable body) => [LStmtLR (GhcPass idL) (GhcPass idR) body] -> SDoc pprDo :: forall (p :: Pass) body any. (OutputableBndrId p, Outputable body) => HsStmtContext any -> [LStmt (GhcPass p) body] -> SDoc pprBy :: Outputable body => Maybe body -> SDoc pprTransStmt :: Outputable body => Maybe body -> body -> TransForm -> SDoc pprTransformStmt :: forall (p :: Pass). OutputableBndrId p => [IdP (GhcPass p)] -> LHsExpr (GhcPass p) -> Maybe (LHsExpr (GhcPass p)) -> SDoc pprArg :: forall (idL :: Pass). OutputableBndrId idL => ApplicativeArg (GhcPass idL) -> SDoc pprStmt :: forall (idL :: Pass) (idR :: Pass) body. (OutputableBndrId idL, OutputableBndrId idR, Outputable body) => StmtLR (GhcPass idL) (GhcPass idR) body -> SDoc pp_rhs :: Outputable body => HsMatchContext idL -> body -> SDoc pprGRHS :: forall (idR :: Pass) body idL. (OutputableBndrId idR, Outputable body) => HsMatchContext idL -> GRHS (GhcPass idR) body -> SDoc pprGRHSs :: forall (idR :: Pass) body idL. (OutputableBndrId idR, Outputable body) => HsMatchContext idL -> GRHSs (GhcPass idR) body -> SDoc pprMatch :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable body) => Match (GhcPass idR) body -> SDoc pprMatches :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable body) => MatchGroup (GhcPass idR) body -> SDoc hsLMatchPats :: forall (id :: Pass) body. LMatch (GhcPass id) body -> [LPat (GhcPass id)] matchGroupArity :: forall (id :: Pass) body. MatchGroup (GhcPass id) body -> Arity -- | Is there only one RHS in this list of matches? isSingletonMatchGroup :: [LMatch id body] -> Bool isEmptyMatchGroup :: MatchGroup id body -> Bool isInfixMatch :: Match id body -> Bool pprCmdArg :: forall (p :: Pass). OutputableBndrId p => HsCmdTop (GhcPass p) -> SDoc ppr_cmd :: forall (p :: Pass). OutputableBndrId p => HsCmd (GhcPass p) -> SDoc ppr_lcmd :: forall (p :: Pass). OutputableBndrId p => LHsCmd (GhcPass p) -> SDoc isQuietHsCmd :: HsCmd id -> Bool pprCmd :: forall (p :: Pass). OutputableBndrId p => HsCmd (GhcPass p) -> SDoc pprLCmd :: forall (p :: Pass). OutputableBndrId p => LHsCmd (GhcPass p) -> SDoc isAtomicHsExpr :: HsExpr id -> Bool -- | parenthesizeHsExpr p e checks if -- hsExprNeedsParens p e is true, and if so, surrounds -- e with an HsPar. Otherwise, it simply returns -- e. parenthesizeHsExpr :: forall (p :: Pass). PprPrec -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -- | hsExprNeedsParens p e returns True if the -- expression e needs parentheses under precedence p. hsExprNeedsParens :: PprPrec -> HsExpr p -> Bool pprParendExpr :: forall (p :: Pass). OutputableBndrId p => PprPrec -> HsExpr (GhcPass p) -> SDoc pprParendLExpr :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LHsExpr (GhcPass p) -> SDoc pprDebugParendExpr :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LHsExpr (GhcPass p) -> SDoc pprExternalSrcLoc :: (StringLiteral, (Int, Int), (Int, Int)) -> SDoc ppr_apps :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> [Either (LHsExpr (GhcPass p)) (LHsWcType (NoGhcTc (GhcPass p)))] -> SDoc ppr_infix_expr :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> Maybe SDoc ppr_expr :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> SDoc ppr_lexpr :: forall (p :: Pass). OutputableBndrId p => LHsExpr (GhcPass p) -> SDoc pprBinds :: forall (idL :: Pass) (idR :: Pass). (OutputableBndrId idL, OutputableBndrId idR) => HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> SDoc isQuietHsExpr :: HsExpr id -> Bool tupArgPresent :: LHsTupArg id -> Bool unboundVarOcc :: UnboundVar -> OccName -- | Make a 'SyntaxExpr Name' (the "rn" is because this is used in the -- renamer), missing its HsWrappers. mkRnSyntaxExpr :: Name -> SyntaxExpr GhcRn -- | Make a 'SyntaxExpr (HsExpr _)', missing its HsWrappers. mkSyntaxExpr :: forall (p :: Pass). HsExpr (GhcPass p) -> SyntaxExpr (GhcPass p) noSyntaxExpr :: forall (p :: Pass). SyntaxExpr (GhcPass p) -- | This is used for rebindable-syntax pieces that are too polymorphic for -- tcSyntaxOp (trS_fmap and the mzip in ParStmt) noExpr :: forall (p :: Pass). HsExpr (GhcPass p) -- | Post-Type checking Expression -- -- PostTcExpr is an evidence expression attached to the syntax tree by -- the type checker (c.f. postTcType). type PostTcExpr = HsExpr GhcTc -- | Post-Type checking Table -- -- We use a PostTcTable where there are a bunch of pieces of evidence, -- more than is convenient to keep individually. type PostTcTable = [(Name, PostTcExpr)] -- | Command Syntax Table (for Arrow syntax) type CmdSyntaxTable p = [(Name, HsExpr p)] -- | An unbound variable; used for treating out-of-scope variables as -- expression holes -- -- Either "x", "y" Plain OutOfScope or "_", "_x" A TrueExprHole -- -- Both forms indicate an out-of-scope variable, but the latter indicates -- that the user expects it to be out of scope, and just wants GHC -- to report its type data UnboundVar -- | An (unqualified) out-of-scope variable, together with the GlobalRdrEnv -- with respect to which it is unbound OutOfScope :: OccName -> GlobalRdrEnv -> UnboundVar -- | A "true" expression hole (_ or _x) TrueExprHole :: OccName -> UnboundVar -- | Extra data fields for a RecordCon, added by the type checker data RecordConTc RecordConTc :: ConLike -> PostTcExpr -> RecordConTc [rcon_con_like] :: RecordConTc -> ConLike [rcon_con_expr] :: RecordConTc -> PostTcExpr -- | Extra data fields for a RecordUpd, added by the type checker data RecordUpdTc RecordUpdTc :: [ConLike] -> [Type] -> [Type] -> HsWrapper -> RecordUpdTc [rupd_cons] :: RecordUpdTc -> [ConLike] [rupd_in_tys] :: RecordUpdTc -> [Type] [rupd_out_tys] :: RecordUpdTc -> [Type] [rupd_wrap] :: RecordUpdTc -> HsWrapper -- | Located Haskell Tuple Argument -- -- HsTupArg is used for tuple sections (,a,) is -- represented by ExplicitTuple [Missing ty1, Present a, Missing -- ty3] Which in turn stands for (x:ty1 y:ty2. (x,a,y)) type LHsTupArg id = Located HsTupArg id -- | -- -- Haskell Tuple Argument data HsTupArg id -- | The argument Present :: XPresent id -> LHsExpr id -> HsTupArg id -- | The argument is missing, but this is its type Missing :: XMissing id -> HsTupArg id -- | Note [Trees that Grow] extension point XTupArg :: XXTupArg id -> HsTupArg id -- | Located Haskell Command (for arrow syntax) type LHsCmd id = Located HsCmd id -- | Haskell Array Application Type data HsArrAppType HsHigherOrderApp :: HsArrAppType HsFirstOrderApp :: HsArrAppType -- | Top-level command, introducing a new arrow. This may occur inside a -- proc (where the stack is empty) or as an argument of a command-forming -- operator. -- -- Located Haskell Top-level Command type LHsCmdTop p = Located HsCmdTop p -- | Haskell Top-level Command data HsCmdTop p HsCmdTop :: XCmdTop p -> LHsCmd p -> HsCmdTop p XCmdTop :: XXCmdTop p -> HsCmdTop p data CmdTopTc CmdTopTc :: Type -> Type -> CmdSyntaxTable GhcTc -> CmdTopTc -- | Haskell Record Bindings type HsRecordBinds p = HsRecFields p LHsExpr p data MatchGroupTc MatchGroupTc :: [Type] -> Type -> MatchGroupTc [mg_arg_tys] :: MatchGroupTc -> [Type] [mg_res_ty] :: MatchGroupTc -> Type -- | Located Match -- -- May have AnnKeywordId : AnnSemi when in a list type LMatch id body = Located Match id body data Match p body Match :: XCMatch p body -> HsMatchContext (NameOrRdrName (IdP p)) -> [LPat p] -> GRHSs p body -> Match p body [m_ext] :: Match p body -> XCMatch p body [m_ctxt] :: Match p body -> HsMatchContext (NameOrRdrName (IdP p)) [m_pats] :: Match p body -> [LPat p] [m_grhss] :: Match p body -> GRHSs p body XMatch :: XXMatch p body -> Match p body -- | Located Guarded Right-Hand Side type LGRHS id body = Located GRHS id body -- | Guarded Right Hand Side. data GRHS p body GRHS :: XCGRHS p body -> [GuardLStmt p] -> body -> GRHS p body XGRHS :: XXGRHS p body -> GRHS p body -- | Located do block Statement type LStmt id body = Located StmtLR id id body -- | Located Statement with separate Left and Right id's type LStmtLR idL idR body = Located StmtLR idL idR body -- | do block Statement type Stmt id body = StmtLR id id body -- | Command Located Statement type CmdLStmt id = LStmt id LHsCmd id -- | Command Statement type CmdStmt id = Stmt id LHsCmd id -- | Expression Located Statement type ExprLStmt id = LStmt id LHsExpr id -- | Expression Statement type ExprStmt id = Stmt id LHsExpr id -- | Guard Located Statement type GuardLStmt id = LStmt id LHsExpr id -- | Guard Statement type GuardStmt id = Stmt id LHsExpr id -- | Ghci Located Statement type GhciLStmt id = LStmt id LHsExpr id -- | Ghci Statement type GhciStmt id = Stmt id LHsExpr id -- | API Annotations when in qualifier lists or guards - -- AnnKeywordId : AnnVbar, AnnComma,AnnThen, -- AnnBy,AnnBy, AnnGroup,AnnUsing data StmtLR idL idR body LastStmt :: XLastStmt idL idR body -> body -> Bool -> SyntaxExpr idR -> StmtLR idL idR body BindStmt :: XBindStmt idL idR body -> LPat idL -> body -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body -- | ApplicativeStmt represents an applicative expression built with -- <$> and <*>. It is generated by the renamer, -- and is desugared into the appropriate applicative expression by the -- desugarer, but it is intended to be invisible in error messages. -- -- For full details, see Note [ApplicativeDo] in RnExpr ApplicativeStmt :: XApplicativeStmt idL idR body -> [(SyntaxExpr idR, ApplicativeArg idL)] -> Maybe (SyntaxExpr idR) -> StmtLR idL idR body BodyStmt :: XBodyStmt idL idR body -> body -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body -- | LetStmt :: XLetStmt idL idR body -> LHsLocalBindsLR idL idR -> StmtLR idL idR body ParStmt :: XParStmt idL idR body -> [ParStmtBlock idL idR] -> HsExpr idR -> SyntaxExpr idR -> StmtLR idL idR body TransStmt :: XTransStmt idL idR body -> TransForm -> [ExprLStmt idL] -> [(IdP idR, IdP idR)] -> LHsExpr idR -> Maybe (LHsExpr idR) -> SyntaxExpr idR -> SyntaxExpr idR -> HsExpr idR -> StmtLR idL idR body [trS_ext] :: StmtLR idL idR body -> XTransStmt idL idR body [trS_form] :: StmtLR idL idR body -> TransForm [trS_stmts] :: StmtLR idL idR body -> [ExprLStmt idL] [trS_bndrs] :: StmtLR idL idR body -> [(IdP idR, IdP idR)] [trS_using] :: StmtLR idL idR body -> LHsExpr idR [trS_by] :: StmtLR idL idR body -> Maybe (LHsExpr idR) [trS_ret] :: StmtLR idL idR body -> SyntaxExpr idR [trS_bind] :: StmtLR idL idR body -> SyntaxExpr idR [trS_fmap] :: StmtLR idL idR body -> HsExpr idR -- | RecStmt :: XRecStmt idL idR body -> [LStmtLR idL idR body] -> [IdP idR] -> [IdP idR] -> SyntaxExpr idR -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body [recS_ext] :: StmtLR idL idR body -> XRecStmt idL idR body [recS_stmts] :: StmtLR idL idR body -> [LStmtLR idL idR body] [recS_later_ids] :: StmtLR idL idR body -> [IdP idR] [recS_rec_ids] :: StmtLR idL idR body -> [IdP idR] [recS_bind_fn] :: StmtLR idL idR body -> SyntaxExpr idR [recS_ret_fn] :: StmtLR idL idR body -> SyntaxExpr idR [recS_mfix_fn] :: StmtLR idL idR body -> SyntaxExpr idR XStmtLR :: XXStmtLR idL idR body -> StmtLR idL idR body data RecStmtTc RecStmtTc :: Type -> [PostTcExpr] -> [PostTcExpr] -> Type -> RecStmtTc [recS_bind_ty] :: RecStmtTc -> Type [recS_later_rets] :: RecStmtTc -> [PostTcExpr] [recS_rec_rets] :: RecStmtTc -> [PostTcExpr] [recS_ret_ty] :: RecStmtTc -> Type data TransForm ThenForm :: TransForm GroupForm :: TransForm -- | Parenthesised Statement Block data ParStmtBlock idL idR ParStmtBlock :: XParStmtBlock idL idR -> [ExprLStmt idL] -> [IdP idR] -> SyntaxExpr idR -> ParStmtBlock idL idR XParStmtBlock :: XXParStmtBlock idL idR -> ParStmtBlock idL idR -- | Applicative Argument data ApplicativeArg idL ApplicativeArgOne :: XApplicativeArgOne idL -> LPat idL -> LHsExpr idL -> Bool -> SyntaxExpr idL -> ApplicativeArg idL [xarg_app_arg_one] :: ApplicativeArg idL -> XApplicativeArgOne idL [app_arg_pattern] :: ApplicativeArg idL -> LPat idL [arg_expr] :: ApplicativeArg idL -> LHsExpr idL [is_body_stmt] :: ApplicativeArg idL -> Bool [fail_operator] :: ApplicativeArg idL -> SyntaxExpr idL ApplicativeArgMany :: XApplicativeArgMany idL -> [ExprLStmt idL] -> HsExpr idL -> LPat idL -> ApplicativeArg idL [xarg_app_arg_many] :: ApplicativeArg idL -> XApplicativeArgMany idL [app_stmts] :: ApplicativeArg idL -> [ExprLStmt idL] [final_expr] :: ApplicativeArg idL -> HsExpr idL [bv_pattern] :: ApplicativeArg idL -> LPat idL XApplicativeArg :: XXApplicativeArg idL -> ApplicativeArg idL -- | A splice can appear with various decorations wrapped around it. This -- data type captures explicitly how it was originally written, for use -- in the pretty printer. data SpliceDecoration -- | $( splice ) or $$( splice ) HasParens :: SpliceDecoration -- | $splice or $$splice HasDollar :: SpliceDecoration -- | bare splice NoParens :: SpliceDecoration -- | Finalizers produced by a splice with addModFinalizer -- -- See Note [Delaying modFinalizers in untyped splices] in RnSplice. For -- how this is used. newtype ThModFinalizers ThModFinalizers :: [ForeignRef (Q ())] -> ThModFinalizers data DelayedSplice DelayedSplice :: TcLclEnv -> LHsExpr GhcRn -> TcType -> LHsExpr GhcTcId -> DelayedSplice -- | Haskell Spliced Thing -- -- Values that can result from running a splice. data HsSplicedThing id -- | Haskell Spliced Expression HsSplicedExpr :: HsExpr id -> HsSplicedThing id -- | Haskell Spliced Type HsSplicedTy :: HsType id -> HsSplicedThing id -- | Haskell Spliced Pattern HsSplicedPat :: Pat id -> HsSplicedThing id type SplicePointName = Name -- | Pending Renamer Splice data PendingRnSplice PendingRnSplice :: UntypedSpliceFlavour -> SplicePointName -> LHsExpr GhcRn -> PendingRnSplice data UntypedSpliceFlavour UntypedExpSplice :: UntypedSpliceFlavour UntypedPatSplice :: UntypedSpliceFlavour UntypedTypeSplice :: UntypedSpliceFlavour UntypedDeclSplice :: UntypedSpliceFlavour -- | Pending Type-checker Splice data PendingTcSplice PendingTcSplice :: SplicePointName -> LHsExpr GhcTc -> PendingTcSplice -- | Haskell Bracket data HsBracket p ExpBr :: XExpBr p -> LHsExpr p -> HsBracket p PatBr :: XPatBr p -> LPat p -> HsBracket p DecBrL :: XDecBrL p -> [LHsDecl p] -> HsBracket p DecBrG :: XDecBrG p -> HsGroup p -> HsBracket p TypBr :: XTypBr p -> LHsType p -> HsBracket p VarBr :: XVarBr p -> Bool -> IdP p -> HsBracket p TExpBr :: XTExpBr p -> LHsExpr p -> HsBracket p XBracket :: XXBracket p -> HsBracket p -- | Arithmetic Sequence Information data ArithSeqInfo id From :: LHsExpr id -> ArithSeqInfo id FromThen :: LHsExpr id -> LHsExpr id -> ArithSeqInfo id FromTo :: LHsExpr id -> LHsExpr id -> ArithSeqInfo id FromThenTo :: LHsExpr id -> LHsExpr id -> LHsExpr id -> ArithSeqInfo id -- | Haskell Match Context -- -- Context of a pattern match. This is more subtle than it would seem. -- See Note [Varieties of pattern matches]. data HsMatchContext id -- | A pattern matching on an argument of a function binding FunRhs :: Located id -> LexicalFixity -> SrcStrictness -> HsMatchContext id -- | function binder of f [mc_fun] :: HsMatchContext id -> Located id -- | fixing of f [mc_fixity] :: HsMatchContext id -> LexicalFixity -- | was f banged? See Note [FunBind vs PatBind] [mc_strictness] :: HsMatchContext id -> SrcStrictness -- | Patterns of a lambda LambdaExpr :: HsMatchContext id -- | Patterns and guards on a case alternative CaseAlt :: HsMatchContext id -- | Guards of a multi-way if alternative IfAlt :: HsMatchContext id -- | Patterns of a proc ProcExpr :: HsMatchContext id -- | A pattern binding eg [y] <- e = e PatBindRhs :: HsMatchContext id -- | Guards of pattern bindings, e.g., (Just b) | Just _ <- x = e | -- otherwise = e' PatBindGuards :: HsMatchContext id -- | Record update [used only in DsExpr to tell matchWrapper what sort of -- runtime error message to generate] RecUpd :: HsMatchContext id -- | Pattern of a do-stmt, list comprehension, pattern guard, etc StmtCtxt :: HsStmtContext id -> HsMatchContext id -- | A Template Haskell pattern splice ThPatSplice :: HsMatchContext id -- | A Template Haskell pattern quotation [p| (a,b) |] ThPatQuote :: HsMatchContext id -- | A pattern synonym declaration PatSyn :: HsMatchContext id -- | Haskell Statement Context. It expects to be parameterised with one of -- RdrName, Name or Id data HsStmtContext id ListComp :: HsStmtContext id MonadComp :: HsStmtContext id -- | do { ... } DoExpr :: HsStmtContext id -- | mdo { ... } ie recursive do-expression MDoExpr :: HsStmtContext id -- | do-notation in an arrow-command context ArrowExpr :: HsStmtContext id -- | A command-line Stmt in GHCi pat <- rhs GhciStmtCtxt :: HsStmtContext id -- | Pattern guard for specified thing PatGuard :: HsMatchContext id -> HsStmtContext id -- | A branch of a parallel stmt ParStmtCtxt :: HsStmtContext id -> HsStmtContext id -- | A branch of a transform stmt TransStmtCtxt :: HsStmtContext id -> HsStmtContext id roleAnnotDeclName :: forall (p :: Pass). RoleAnnotDecl (GhcPass p) -> IdP (GhcPass p) annProvenanceName_maybe :: AnnProvenance name -> Maybe name docDeclDoc :: DocDecl -> HsDocString pprFullRuleName :: Located (SourceText, RuleName) -> SDoc collectRuleBndrSigTys :: [RuleBndr pass] -> [LHsSigWcType pass] flattenRuleDecls :: [LRuleDecls pass] -> [LRuleDecl pass] -- | Map over the via type if dealing with ViaStrategy. -- Otherwise, return the DerivStrategy unchanged. mapDerivStrategy :: forall p (pass :: Pass). p ~ GhcPass pass => (XViaStrategy p -> XViaStrategy p) -> DerivStrategy p -> DerivStrategy p -- | Eliminate a DerivStrategy. foldDerivStrategy :: forall p (pass :: Pass) r. p ~ GhcPass pass => r -> (XViaStrategy p -> r) -> DerivStrategy p -> r -- | A short description of a DerivStrategy'. derivStrategyName :: DerivStrategy a -> SDoc instDeclDataFamInsts :: forall (p :: Pass). [LInstDecl (GhcPass p)] -> [DataFamInstDecl (GhcPass p)] pprHsFamInstLHS :: forall (p :: Pass). OutputableBndrId p => IdP (GhcPass p) -> Maybe [LHsTyVarBndr (GhcPass p)] -> HsTyPats (GhcPass p) -> LexicalFixity -> LHsContext (GhcPass p) -> SDoc pprDataFamInstFlavour :: forall (p :: Pass). DataFamInstDecl (GhcPass p) -> SDoc pprTyFamInstDecl :: forall (p :: Pass). OutputableBndrId p => TopLevelFlag -> TyFamInstDecl (GhcPass p) -> SDoc hsConDeclTheta :: Maybe (LHsContext pass) -> [LHsType pass] hsConDeclArgTys :: HsConDeclDetails pass -> [LBangType pass] getConArgs :: ConDecl pass -> HsConDeclDetails pass getConNames :: forall (p :: Pass). ConDecl (GhcPass p) -> [Located (IdP (GhcPass p))] -- | Convert a NewOrData to a TyConFlavour newOrDataToFlavour :: NewOrData -> TyConFlavour standaloneKindSigName :: forall (p :: Pass). StandaloneKindSig (GhcPass p) -> IdP (GhcPass p) -- | Maybe return name of the result type variable resultVariableName :: forall (a :: Pass). FamilyResultSig (GhcPass a) -> Maybe (IdP (GhcPass a)) famResultKindSignature :: forall (p :: Pass). FamilyResultSig (GhcPass p) -> Maybe (LHsKind (GhcPass p)) familyDeclName :: forall (p :: Pass). FamilyDecl (GhcPass p) -> IdP (GhcPass p) familyDeclLName :: forall (p :: Pass). FamilyDecl (GhcPass p) -> Located (IdP (GhcPass p)) tyClGroupKindSigs :: [TyClGroup pass] -> [LStandaloneKindSig pass] tyClGroupRoleDecls :: [TyClGroup pass] -> [LRoleAnnotDecl pass] tyClGroupInstDecls :: [TyClGroup pass] -> [LInstDecl pass] tyClGroupTyClDecls :: [TyClGroup pass] -> [LTyClDecl pass] pprTyClDeclFlavour :: forall (p :: Pass). TyClDecl (GhcPass p) -> SDoc -- | Does this declaration have a complete, user-supplied kind signature? -- See Note [CUSKs: complete user-supplied kind signatures] hsDeclHasCusk :: TyClDecl GhcRn -> Bool countTyClDecls :: [TyClDecl pass] -> (Int, Int, Int, Int, Int) tyClDeclTyVars :: TyClDecl pass -> LHsQTyVars pass tcdName :: forall (p :: Pass). TyClDecl (GhcPass p) -> IdP (GhcPass p) tyClDeclLName :: forall (p :: Pass). TyClDecl (GhcPass p) -> Located (IdP (GhcPass p)) tyFamInstDeclLName :: forall (p :: Pass). TyFamInstDecl (GhcPass p) -> Located (IdP (GhcPass p)) tyFamInstDeclName :: forall (p :: Pass). TyFamInstDecl (GhcPass p) -> IdP (GhcPass p) -- | data family declaration isDataFamilyDecl :: TyClDecl pass -> Bool -- | closed type family info isClosedTypeFamilyInfo :: FamilyInfo pass -> Bool -- | open type family info isOpenTypeFamilyInfo :: FamilyInfo pass -> Bool -- | type family declaration isTypeFamilyDecl :: TyClDecl pass -> Bool -- | type/data family declaration isFamilyDecl :: TyClDecl pass -> Bool -- | type class isClassDecl :: TyClDecl pass -> Bool -- | type or type instance declaration isSynDecl :: TyClDecl pass -> Bool -- | True = argument is a data/newtype -- declaration. isDataDecl :: TyClDecl pass -> Bool appendGroups :: forall (p :: Pass). HsGroup (GhcPass p) -> HsGroup (GhcPass p) -> HsGroup (GhcPass p) hsGroupInstDecls :: HsGroup id -> [LInstDecl id] emptyRnGroup :: forall (p :: Pass). HsGroup (GhcPass p) emptyRdrGroup :: forall (p :: Pass). HsGroup (GhcPass p) type LHsDecl p = Located HsDecl p -- | A Haskell Declaration data HsDecl p -- | Type or Class Declaration TyClD :: XTyClD p -> TyClDecl p -> HsDecl p -- | Instance declaration InstD :: XInstD p -> InstDecl p -> HsDecl p -- | Deriving declaration DerivD :: XDerivD p -> DerivDecl p -> HsDecl p -- | Value declaration ValD :: XValD p -> HsBind p -> HsDecl p -- | Signature declaration SigD :: XSigD p -> Sig p -> HsDecl p -- | Standalone kind signature KindSigD :: XKindSigD p -> StandaloneKindSig p -> HsDecl p -- | 'default' declaration DefD :: XDefD p -> DefaultDecl p -> HsDecl p -- | Foreign declaration ForD :: XForD p -> ForeignDecl p -> HsDecl p -- | Warning declaration WarningD :: XWarningD p -> WarnDecls p -> HsDecl p -- | Annotation declaration AnnD :: XAnnD p -> AnnDecl p -> HsDecl p -- | Rule declaration RuleD :: XRuleD p -> RuleDecls p -> HsDecl p -- | Splice declaration (Includes quasi-quotes) SpliceD :: XSpliceD p -> SpliceDecl p -> HsDecl p -- | Documentation comment declaration DocD :: XDocD p -> DocDecl -> HsDecl p -- | Role annotation declaration RoleAnnotD :: XRoleAnnotD p -> RoleAnnotDecl p -> HsDecl p XHsDecl :: XXHsDecl p -> HsDecl p -- | Haskell Group -- -- A HsDecl is categorised into a HsGroup before being fed -- to the renamer. data HsGroup p HsGroup :: XCHsGroup p -> HsValBinds p -> [LSpliceDecl p] -> [TyClGroup p] -> [LDerivDecl p] -> [LFixitySig p] -> [LDefaultDecl p] -> [LForeignDecl p] -> [LWarnDecls p] -> [LAnnDecl p] -> [LRuleDecls p] -> [LDocDecl] -> HsGroup p [hs_ext] :: HsGroup p -> XCHsGroup p [hs_valds] :: HsGroup p -> HsValBinds p [hs_splcds] :: HsGroup p -> [LSpliceDecl p] [hs_tyclds] :: HsGroup p -> [TyClGroup p] [hs_derivds] :: HsGroup p -> [LDerivDecl p] [hs_fixds] :: HsGroup p -> [LFixitySig p] [hs_defds] :: HsGroup p -> [LDefaultDecl p] [hs_fords] :: HsGroup p -> [LForeignDecl p] [hs_warnds] :: HsGroup p -> [LWarnDecls p] [hs_annds] :: HsGroup p -> [LAnnDecl p] [hs_ruleds] :: HsGroup p -> [LRuleDecls p] [hs_docs] :: HsGroup p -> [LDocDecl] XHsGroup :: XXHsGroup p -> HsGroup p -- | Located Splice Declaration type LSpliceDecl pass = Located SpliceDecl pass -- | Splice Declaration data SpliceDecl p SpliceDecl :: XSpliceDecl p -> Located (HsSplice p) -> SpliceExplicitFlag -> SpliceDecl p XSpliceDecl :: XXSpliceDecl p -> SpliceDecl p -- | Located Declaration of a Type or Class type LTyClDecl pass = Located TyClDecl pass -- | A type or class declaration. data TyClDecl pass -- |
--   type/data family T :: *->*
--   
-- -- FamDecl :: XFamDecl pass -> FamilyDecl pass -> TyClDecl pass [tcdFExt] :: TyClDecl pass -> XFamDecl pass [tcdFam] :: TyClDecl pass -> FamilyDecl pass -- | type declaration -- -- SynDecl :: XSynDecl pass -> Located (IdP pass) -> LHsQTyVars pass -> LexicalFixity -> LHsType pass -> TyClDecl pass -- | Post renameer, FVs [tcdSExt] :: TyClDecl pass -> XSynDecl pass -- | Type constructor [tcdLName] :: TyClDecl pass -> Located (IdP pass) -- | Type variables; for an associated type these include outer binders [tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass -- | Fixity used in the declaration [tcdFixity] :: TyClDecl pass -> LexicalFixity [tcdRhs] :: TyClDecl pass -> LHsType pass -- | data declaration -- -- DataDecl :: XDataDecl pass -> Located (IdP pass) -> LHsQTyVars pass -> LexicalFixity -> HsDataDefn pass -> TyClDecl pass -- | Post renamer, CUSK flag, FVs [tcdDExt] :: TyClDecl pass -> XDataDecl pass -- | Type constructor [tcdLName] :: TyClDecl pass -> Located (IdP pass) -- | Type variables; for an associated type these include outer binders [tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass -- | Fixity used in the declaration [tcdFixity] :: TyClDecl pass -> LexicalFixity [tcdDataDefn] :: TyClDecl pass -> HsDataDefn pass -- | ClassDecl :: XClassDecl pass -> LHsContext pass -> Located (IdP pass) -> LHsQTyVars pass -> LexicalFixity -> [LHsFunDep pass] -> [LSig pass] -> LHsBinds pass -> [LFamilyDecl pass] -> [LTyFamDefltDecl pass] -> [LDocDecl] -> TyClDecl pass -- | Post renamer, FVs [tcdCExt] :: TyClDecl pass -> XClassDecl pass -- | Context... [tcdCtxt] :: TyClDecl pass -> LHsContext pass -- | Type constructor [tcdLName] :: TyClDecl pass -> Located (IdP pass) -- | Type variables; for an associated type these include outer binders [tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass -- | Fixity used in the declaration [tcdFixity] :: TyClDecl pass -> LexicalFixity -- | Functional deps [tcdFDs] :: TyClDecl pass -> [LHsFunDep pass] -- | Methods' signatures [tcdSigs] :: TyClDecl pass -> [LSig pass] -- | Default methods [tcdMeths] :: TyClDecl pass -> LHsBinds pass -- | Associated types; [tcdATs] :: TyClDecl pass -> [LFamilyDecl pass] -- | Associated type defaults [tcdATDefs] :: TyClDecl pass -> [LTyFamDefltDecl pass] -- | Haddock docs [tcdDocs] :: TyClDecl pass -> [LDocDecl] XTyClDecl :: XXTyClDecl pass -> TyClDecl pass type LHsFunDep pass = Located FunDep Located IdP pass data DataDeclRn DataDeclRn :: Bool -> NameSet -> DataDeclRn -- | does this have a CUSK? See Note [CUSKs: complete user-supplied kind -- signatures] [tcdDataCusk] :: DataDeclRn -> Bool [tcdFVs] :: DataDeclRn -> NameSet -- | Type or Class Group data TyClGroup pass TyClGroup :: XCTyClGroup pass -> [LTyClDecl pass] -> [LRoleAnnotDecl pass] -> [LStandaloneKindSig pass] -> [LInstDecl pass] -> TyClGroup pass [group_ext] :: TyClGroup pass -> XCTyClGroup pass [group_tyclds] :: TyClGroup pass -> [LTyClDecl pass] [group_roles] :: TyClGroup pass -> [LRoleAnnotDecl pass] [group_kisigs] :: TyClGroup pass -> [LStandaloneKindSig pass] [group_instds] :: TyClGroup pass -> [LInstDecl pass] XTyClGroup :: XXTyClGroup pass -> TyClGroup pass -- | Located type Family Result Signature type LFamilyResultSig pass = Located FamilyResultSig pass -- | type Family Result Signature data FamilyResultSig pass -- | NoSig :: XNoSig pass -> FamilyResultSig pass -- | KindSig :: XCKindSig pass -> LHsKind pass -> FamilyResultSig pass -- | TyVarSig :: XTyVarSig pass -> LHsTyVarBndr pass -> FamilyResultSig pass XFamilyResultSig :: XXFamilyResultSig pass -> FamilyResultSig pass -- | Located type Family Declaration type LFamilyDecl pass = Located FamilyDecl pass -- | type Family Declaration data FamilyDecl pass FamilyDecl :: XCFamilyDecl pass -> FamilyInfo pass -> Located (IdP pass) -> LHsQTyVars pass -> LexicalFixity -> LFamilyResultSig pass -> Maybe (LInjectivityAnn pass) -> FamilyDecl pass [fdExt] :: FamilyDecl pass -> XCFamilyDecl pass [fdInfo] :: FamilyDecl pass -> FamilyInfo pass [fdLName] :: FamilyDecl pass -> Located (IdP pass) [fdTyVars] :: FamilyDecl pass -> LHsQTyVars pass [fdFixity] :: FamilyDecl pass -> LexicalFixity [fdResultSig] :: FamilyDecl pass -> LFamilyResultSig pass [fdInjectivityAnn] :: FamilyDecl pass -> Maybe (LInjectivityAnn pass) -- | XFamilyDecl :: XXFamilyDecl pass -> FamilyDecl pass -- | Located Injectivity Annotation type LInjectivityAnn pass = Located InjectivityAnn pass -- | If the user supplied an injectivity annotation it is represented using -- InjectivityAnn. At the moment this is a single injectivity condition - -- see Note [Injectivity annotation]. `Located name` stores the LHS of -- injectivity condition. `[Located name]` stores the RHS of injectivity -- condition. Example: -- -- type family Foo a b c = r | r -> a c where ... -- -- This will be represented as "InjectivityAnn r [a, -- c]" data InjectivityAnn pass -- | InjectivityAnn :: Located (IdP pass) -> [Located (IdP pass)] -> InjectivityAnn pass data FamilyInfo pass DataFamily :: FamilyInfo pass OpenTypeFamily :: FamilyInfo pass -- | Nothing if we're in an hs-boot file and the user said "type -- family Foo x where .." ClosedTypeFamily :: Maybe [LTyFamInstEqn pass] -> FamilyInfo pass -- | Haskell Data type Definition data HsDataDefn pass -- | Declares a data type or newtype, giving its constructors -- data/newtype T a = constrs data/newtype instance T [a] = -- constrs HsDataDefn :: XCHsDataDefn pass -> NewOrData -> LHsContext pass -> Maybe (Located CType) -> Maybe (LHsKind pass) -> [LConDecl pass] -> HsDeriving pass -> HsDataDefn pass [dd_ext] :: HsDataDefn pass -> XCHsDataDefn pass [dd_ND] :: HsDataDefn pass -> NewOrData -- | Context [dd_ctxt] :: HsDataDefn pass -> LHsContext pass [dd_cType] :: HsDataDefn pass -> Maybe (Located CType) -- | Optional kind signature. -- -- (Just k) for a GADT-style data, or data -- instance decl, with explicit kind sig -- -- Always Nothing for H98-syntax decls [dd_kindSig] :: HsDataDefn pass -> Maybe (LHsKind pass) -- | Data constructors -- -- For data T a = T1 | T2 a the LConDecls all have -- ConDeclH98. For data T a where { T1 :: T a } the -- LConDecls all have ConDeclGADT. [dd_cons] :: HsDataDefn pass -> [LConDecl pass] -- | Optional 'deriving' claues [dd_derivs] :: HsDataDefn pass -> HsDeriving pass XHsDataDefn :: XXHsDataDefn pass -> HsDataDefn pass -- | Haskell Deriving clause type HsDeriving pass = Located [LHsDerivingClause pass] type LHsDerivingClause pass = Located HsDerivingClause pass -- | A single deriving clause of a data declaration. -- -- data HsDerivingClause pass HsDerivingClause :: XCHsDerivingClause pass -> Maybe (LDerivStrategy pass) -> Located [LHsSigType pass] -> HsDerivingClause pass [deriv_clause_ext] :: HsDerivingClause pass -> XCHsDerivingClause pass -- | The user-specified strategy (if any) to use when deriving -- deriv_clause_tys. [deriv_clause_strategy] :: HsDerivingClause pass -> Maybe (LDerivStrategy pass) -- | The types to derive. -- -- It uses LHsSigTypes because, with -- -XGeneralizedNewtypeDeriving, we can mention type variables -- that aren't bound by the datatype, e.g. -- --
--   data T b = ... deriving (C [a])
--   
-- -- should produce a derived instance for C [a] (T b). [deriv_clause_tys] :: HsDerivingClause pass -> Located [LHsSigType pass] XHsDerivingClause :: XXHsDerivingClause pass -> HsDerivingClause pass -- | Located Standalone Kind Signature type LStandaloneKindSig pass = Located StandaloneKindSig pass data StandaloneKindSig pass StandaloneKindSig :: XStandaloneKindSig pass -> Located (IdP pass) -> LHsSigType pass -> StandaloneKindSig pass XStandaloneKindSig :: XXStandaloneKindSig pass -> StandaloneKindSig pass data NewOrData -- |
--   newtype Blah ...
--   
NewType :: NewOrData -- |
--   data Blah ...
--   
DataType :: NewOrData -- | Located data Constructor Declaration type LConDecl pass = Located ConDecl pass -- |
--   data T b = forall a. Eq a => MkT a b
--     MkT :: forall b a. Eq a => MkT a b
--   
--   data T b where
--        MkT1 :: Int -> T Int
--   
--   data T = Int MkT Int
--          | MkT2
--   
--   data T a where
--        Int MkT Int :: T Int
--   
-- -- -- -- data Constructor Declaration data ConDecl pass ConDeclGADT :: XConDeclGADT pass -> [Located (IdP pass)] -> Located Bool -> LHsQTyVars pass -> Maybe (LHsContext pass) -> HsConDeclDetails pass -> LHsType pass -> Maybe LHsDocString -> ConDecl pass [con_g_ext] :: ConDecl pass -> XConDeclGADT pass [con_names] :: ConDecl pass -> [Located (IdP pass)] -- | True = explicit forall False => hsq_explicit is empty [con_forall] :: ConDecl pass -> Located Bool [con_qvars] :: ConDecl pass -> LHsQTyVars pass -- | User-written context (if any) [con_mb_cxt] :: ConDecl pass -> Maybe (LHsContext pass) -- | Arguments; never InfixCon [con_args] :: ConDecl pass -> HsConDeclDetails pass -- | Result type [con_res_ty] :: ConDecl pass -> LHsType pass -- | A possible Haddock comment. [con_doc] :: ConDecl pass -> Maybe LHsDocString ConDeclH98 :: XConDeclH98 pass -> Located (IdP pass) -> Located Bool -> [LHsTyVarBndr pass] -> Maybe (LHsContext pass) -> HsConDeclDetails pass -> Maybe LHsDocString -> ConDecl pass [con_ext] :: ConDecl pass -> XConDeclH98 pass [con_name] :: ConDecl pass -> Located (IdP pass) -- | True = explicit forall False => hsq_explicit is empty [con_forall] :: ConDecl pass -> Located Bool -- | Existentials only [con_ex_tvs] :: ConDecl pass -> [LHsTyVarBndr pass] -- | User-written context (if any) [con_mb_cxt] :: ConDecl pass -> Maybe (LHsContext pass) -- | Arguments; never InfixCon [con_args] :: ConDecl pass -> HsConDeclDetails pass -- | A possible Haddock comment. [con_doc] :: ConDecl pass -> Maybe LHsDocString XConDecl :: XXConDecl pass -> ConDecl pass -- | Haskell data Constructor Declaration Details type HsConDeclDetails pass = HsConDetails LBangType pass Located [LConDeclField pass] -- | Located Type Family Instance Equation type LTyFamInstEqn pass = Located TyFamInstEqn pass -- | Haskell Type Patterns type HsTyPats pass = [LHsTypeArg pass] -- | Type Family Instance Equation type TyFamInstEqn pass = FamInstEqn pass LHsType pass -- | Type family default declarations. A convenient synonym for -- TyFamInstDecl. See Note [Type family instance declarations -- in HsSyn]. type TyFamDefltDecl = TyFamInstDecl -- | Located type family default declarations. type LTyFamDefltDecl pass = Located TyFamDefltDecl pass -- | Located Type Family Instance Declaration type LTyFamInstDecl pass = Located TyFamInstDecl pass -- | Type Family Instance Declaration newtype TyFamInstDecl pass -- | TyFamInstDecl :: TyFamInstEqn pass -> TyFamInstDecl pass [tfid_eqn] :: TyFamInstDecl pass -> TyFamInstEqn pass -- | Located Data Family Instance Declaration type LDataFamInstDecl pass = Located DataFamInstDecl pass -- | Data Family Instance Declaration newtype DataFamInstDecl pass -- | DataFamInstDecl :: FamInstEqn pass (HsDataDefn pass) -> DataFamInstDecl pass [dfid_eqn] :: DataFamInstDecl pass -> FamInstEqn pass (HsDataDefn pass) -- | Located Family Instance Equation type LFamInstEqn pass rhs = Located FamInstEqn pass rhs -- | Family Instance Equation type FamInstEqn pass rhs = HsImplicitBndrs pass FamEqn pass rhs -- | Family Equation -- -- One equation in a type family instance declaration, data family -- instance declaration, or type family default. See Note [Type family -- instance declarations in HsSyn] See Note [Family instance declaration -- binders] data FamEqn pass rhs -- | FamEqn :: XCFamEqn pass rhs -> Located (IdP pass) -> Maybe [LHsTyVarBndr pass] -> HsTyPats pass -> LexicalFixity -> rhs -> FamEqn pass rhs [feqn_ext] :: FamEqn pass rhs -> XCFamEqn pass rhs [feqn_tycon] :: FamEqn pass rhs -> Located (IdP pass) -- | Optional quantified type vars [feqn_bndrs] :: FamEqn pass rhs -> Maybe [LHsTyVarBndr pass] [feqn_pats] :: FamEqn pass rhs -> HsTyPats pass -- | Fixity used in the declaration [feqn_fixity] :: FamEqn pass rhs -> LexicalFixity [feqn_rhs] :: FamEqn pass rhs -> rhs XFamEqn :: XXFamEqn pass rhs -> FamEqn pass rhs -- | Located Class Instance Declaration type LClsInstDecl pass = Located ClsInstDecl pass -- | Class Instance Declaration data ClsInstDecl pass -- | ClsInstDecl :: XCClsInstDecl pass -> LHsSigType pass -> LHsBinds pass -> [LSig pass] -> [LTyFamInstDecl pass] -> [LDataFamInstDecl pass] -> Maybe (Located OverlapMode) -> ClsInstDecl pass [cid_ext] :: ClsInstDecl pass -> XCClsInstDecl pass [cid_poly_ty] :: ClsInstDecl pass -> LHsSigType pass [cid_binds] :: ClsInstDecl pass -> LHsBinds pass [cid_sigs] :: ClsInstDecl pass -> [LSig pass] [cid_tyfam_insts] :: ClsInstDecl pass -> [LTyFamInstDecl pass] [cid_datafam_insts] :: ClsInstDecl pass -> [LDataFamInstDecl pass] -- | [cid_overlap_mode] :: ClsInstDecl pass -> Maybe (Located OverlapMode) XClsInstDecl :: XXClsInstDecl pass -> ClsInstDecl pass -- | Located Instance Declaration type LInstDecl pass = Located InstDecl pass -- | Instance Declaration data InstDecl pass ClsInstD :: XClsInstD pass -> ClsInstDecl pass -> InstDecl pass [cid_d_ext] :: InstDecl pass -> XClsInstD pass [cid_inst] :: InstDecl pass -> ClsInstDecl pass DataFamInstD :: XDataFamInstD pass -> DataFamInstDecl pass -> InstDecl pass [dfid_ext] :: InstDecl pass -> XDataFamInstD pass [dfid_inst] :: InstDecl pass -> DataFamInstDecl pass TyFamInstD :: XTyFamInstD pass -> TyFamInstDecl pass -> InstDecl pass [tfid_ext] :: InstDecl pass -> XTyFamInstD pass [tfid_inst] :: InstDecl pass -> TyFamInstDecl pass XInstDecl :: XXInstDecl pass -> InstDecl pass -- | Located stand-alone 'deriving instance' declaration type LDerivDecl pass = Located DerivDecl pass -- | Stand-alone 'deriving instance' declaration data DerivDecl pass DerivDecl :: XCDerivDecl pass -> LHsSigWcType pass -> Maybe (LDerivStrategy pass) -> Maybe (Located OverlapMode) -> DerivDecl pass [deriv_ext] :: DerivDecl pass -> XCDerivDecl pass -- | The instance type to derive. -- -- It uses an LHsSigWcType because the context is allowed to be a -- single wildcard: -- --
--   deriving instance _ => Eq (Foo a)
--   
-- -- Which signifies that the context should be inferred. [deriv_type] :: DerivDecl pass -> LHsSigWcType pass [deriv_strategy] :: DerivDecl pass -> Maybe (LDerivStrategy pass) -- | [deriv_overlap_mode] :: DerivDecl pass -> Maybe (Located OverlapMode) XDerivDecl :: XXDerivDecl pass -> DerivDecl pass -- | A Located DerivStrategy. type LDerivStrategy pass = Located DerivStrategy pass -- | Which technique the user explicitly requested when deriving an -- instance. data DerivStrategy pass -- | GHC's "standard" strategy, which is to implement a custom instance for -- the data type. This only works for certain types that GHC knows about -- (e.g., Eq, Show, Functor when -- -XDeriveFunctor is enabled, etc.) StockStrategy :: DerivStrategy pass -- |
--   -XDeriveAnyClass
--   
AnyclassStrategy :: DerivStrategy pass -- |
--   -XGeneralizedNewtypeDeriving
--   
NewtypeStrategy :: DerivStrategy pass -- |
--   -XDerivingVia
--   
ViaStrategy :: XViaStrategy pass -> DerivStrategy pass -- | Located Default Declaration type LDefaultDecl pass = Located DefaultDecl pass -- | Default Declaration data DefaultDecl pass -- | DefaultDecl :: XCDefaultDecl pass -> [LHsType pass] -> DefaultDecl pass XDefaultDecl :: XXDefaultDecl pass -> DefaultDecl pass -- | Located Foreign Declaration type LForeignDecl pass = Located ForeignDecl pass -- | Foreign Declaration data ForeignDecl pass ForeignImport :: XForeignImport pass -> Located (IdP pass) -> LHsSigType pass -> ForeignImport -> ForeignDecl pass [fd_i_ext] :: ForeignDecl pass -> XForeignImport pass [fd_name] :: ForeignDecl pass -> Located (IdP pass) [fd_sig_ty] :: ForeignDecl pass -> LHsSigType pass [fd_fi] :: ForeignDecl pass -> ForeignImport -- | ForeignExport :: XForeignExport pass -> Located (IdP pass) -> LHsSigType pass -> ForeignExport -> ForeignDecl pass [fd_e_ext] :: ForeignDecl pass -> XForeignExport pass [fd_name] :: ForeignDecl pass -> Located (IdP pass) [fd_sig_ty] :: ForeignDecl pass -> LHsSigType pass [fd_fe] :: ForeignDecl pass -> ForeignExport XForeignDecl :: XXForeignDecl pass -> ForeignDecl pass data ForeignImport CImport :: Located CCallConv -> Located Safety -> Maybe Header -> CImportSpec -> Located SourceText -> ForeignImport data CImportSpec CLabel :: CLabelString -> CImportSpec CFunction :: CCallTarget -> CImportSpec CWrapper :: CImportSpec data ForeignExport CExport :: Located CExportSpec -> Located SourceText -> ForeignExport -- | Located Rule Declarations type LRuleDecls pass = Located RuleDecls pass -- | Rule Declarations data RuleDecls pass HsRules :: XCRuleDecls pass -> SourceText -> [LRuleDecl pass] -> RuleDecls pass [rds_ext] :: RuleDecls pass -> XCRuleDecls pass [rds_src] :: RuleDecls pass -> SourceText [rds_rules] :: RuleDecls pass -> [LRuleDecl pass] XRuleDecls :: XXRuleDecls pass -> RuleDecls pass -- | Located Rule Declaration type LRuleDecl pass = Located RuleDecl pass -- | Rule Declaration data RuleDecl pass -- | HsRule :: XHsRule pass -> Located (SourceText, RuleName) -> Activation -> Maybe [LHsTyVarBndr (NoGhcTc pass)] -> [LRuleBndr pass] -> Located (HsExpr pass) -> Located (HsExpr pass) -> RuleDecl pass -- | After renamer, free-vars from the LHS and RHS [rd_ext] :: RuleDecl pass -> XHsRule pass -- | Note [Pragma source text] in BasicTypes [rd_name] :: RuleDecl pass -> Located (SourceText, RuleName) [rd_act] :: RuleDecl pass -> Activation -- | Forall'd type vars [rd_tyvs] :: RuleDecl pass -> Maybe [LHsTyVarBndr (NoGhcTc pass)] -- | Forall'd term vars, before typechecking; after typechecking this -- includes all forall'd vars [rd_tmvs] :: RuleDecl pass -> [LRuleBndr pass] [rd_lhs] :: RuleDecl pass -> Located (HsExpr pass) [rd_rhs] :: RuleDecl pass -> Located (HsExpr pass) XRuleDecl :: XXRuleDecl pass -> RuleDecl pass data HsRuleRn HsRuleRn :: NameSet -> NameSet -> HsRuleRn -- | Located Rule Binder type LRuleBndr pass = Located RuleBndr pass -- | Rule Binder data RuleBndr pass RuleBndr :: XCRuleBndr pass -> Located (IdP pass) -> RuleBndr pass RuleBndrSig :: XRuleBndrSig pass -> Located (IdP pass) -> LHsSigWcType pass -> RuleBndr pass -- | XRuleBndr :: XXRuleBndr pass -> RuleBndr pass -- | Located Documentation comment Declaration type LDocDecl = Located DocDecl -- | Documentation comment Declaration data DocDecl DocCommentNext :: HsDocString -> DocDecl DocCommentPrev :: HsDocString -> DocDecl DocCommentNamed :: String -> HsDocString -> DocDecl DocGroup :: Int -> HsDocString -> DocDecl -- | Located Warning Declarations type LWarnDecls pass = Located WarnDecls pass -- | Warning pragma Declarations data WarnDecls pass Warnings :: XWarnings pass -> SourceText -> [LWarnDecl pass] -> WarnDecls pass [wd_ext] :: WarnDecls pass -> XWarnings pass [wd_src] :: WarnDecls pass -> SourceText [wd_warnings] :: WarnDecls pass -> [LWarnDecl pass] XWarnDecls :: XXWarnDecls pass -> WarnDecls pass -- | Located Warning pragma Declaration type LWarnDecl pass = Located WarnDecl pass -- | Warning pragma Declaration data WarnDecl pass XWarnDecl :: XXWarnDecl pass -> WarnDecl pass -- | Located Annotation Declaration type LAnnDecl pass = Located AnnDecl pass -- | Annotation Declaration data AnnDecl pass -- | HsAnnotation :: XHsAnnotation pass -> SourceText -> AnnProvenance (IdP pass) -> Located (HsExpr pass) -> AnnDecl pass XAnnDecl :: XXAnnDecl pass -> AnnDecl pass -- | Annotation Provenance data AnnProvenance name ValueAnnProvenance :: Located name -> AnnProvenance name TypeAnnProvenance :: Located name -> AnnProvenance name ModuleAnnProvenance :: AnnProvenance name -- | Located Role Annotation Declaration type LRoleAnnotDecl pass = Located RoleAnnotDecl pass -- | Role Annotation Declaration data RoleAnnotDecl pass -- | RoleAnnotDecl :: XCRoleAnnotDecl pass -> Located (IdP pass) -> [Located (Maybe Role)] -> RoleAnnotDecl pass XRoleAnnotDecl :: XXRoleAnnotDecl pass -> RoleAnnotDecl pass collectEvVarsPat :: Pat GhcTc -> Bag EvVar collectEvVarsPats :: [Pat GhcTc] -> Bag EvVar -- | parenthesizePat p pat checks if -- patNeedsParens p pat is true, and if so, surrounds -- pat with a ParPat. Otherwise, it simply returns -- pat. parenthesizePat :: forall (p :: Pass). PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p) -- | patNeedsParens p pat returns True if the -- pattern pat needs parentheses under precedence p. patNeedsParens :: PprPrec -> Pat p -> Bool isIrrefutableHsPat :: forall (p :: Pass). OutputableBndrId p => LPat (GhcPass p) -> Bool looksLazyPatBind :: forall (p :: Pass). HsBind (GhcPass p) -> Bool isBangedLPat :: forall (p :: Pass). LPat (GhcPass p) -> Bool mkCharLitPat :: forall (p :: Pass). SourceText -> Char -> OutPat (GhcPass p) mkNilPat :: forall (p :: Pass). Type -> OutPat (GhcPass p) mkPrefixConPat :: forall (p :: Pass). DataCon -> [OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p) pprConArgs :: forall (p :: Pass). OutputableBndrId p => HsConPatDetails (GhcPass p) -> SDoc pprParendLPat :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LPat (GhcPass p) -> SDoc hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> LFieldOcc GhcTc hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> Located Id hsRecUpdFieldRdr :: forall (p :: Pass). HsRecUpdField (GhcPass p) -> Located RdrName hsRecFieldId :: HsRecField GhcTc arg -> Located Id hsRecFieldSel :: HsRecField pass arg -> Located (XCFieldOcc pass) hsRecFieldsArgs :: HsRecFields p arg -> [arg] hsRecFields :: HsRecFields p arg -> [XCFieldOcc p] hsConPatArgs :: HsConPatDetails p -> [LPat p] type InPat p = LPat p type OutPat p = LPat p data ListPatTc ListPatTc :: Type -> Maybe (Type, SyntaxExpr GhcTc) -> ListPatTc -- | Haskell Constructor Pattern Details type HsConPatDetails p = HsConDetails LPat p HsRecFields p LPat p -- | Haskell Record Fields -- -- HsRecFields is used only for patterns and expressions (not data type -- declarations) data HsRecFields p arg HsRecFields :: [LHsRecField p arg] -> Maybe (Located Int) -> HsRecFields p arg [rec_flds] :: HsRecFields p arg -> [LHsRecField p arg] [rec_dotdot] :: HsRecFields p arg -> Maybe (Located Int) -- | Located Haskell Record Field type LHsRecField' p arg = Located HsRecField' p arg -- | Located Haskell Record Field type LHsRecField p arg = Located HsRecField p arg -- | Located Haskell Record Update Field type LHsRecUpdField p = Located HsRecUpdField p -- | Haskell Record Field type HsRecField p arg = HsRecField' FieldOcc p arg -- | Haskell Record Update Field type HsRecUpdField p = HsRecField' AmbiguousFieldOcc p LHsExpr p -- | Haskell Record Field -- -- -- -- For details on above see note [Api annotations] in ApiAnnotation data HsRecField' id arg HsRecField :: Located id -> arg -> Bool -> HsRecField' id arg [hsRecFieldLbl] :: HsRecField' id arg -> Located id -- | Filled in by renamer when punning [hsRecFieldArg] :: HsRecField' id arg -> arg -- | Note [Punning] [hsRecPun] :: HsRecField' id arg -> Bool pprMinimalSig :: OutputableBndr name => LBooleanFormula (Located name) -> SDoc pprTcSpecPrags :: TcSpecPrags -> SDoc pprSpec :: OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc pprVarSig :: OutputableBndr id => [id] -> SDoc -> SDoc -- | Using SourceText in case the pragma was spelled differently or used -- mixed case pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc pragBrackets :: SDoc -> SDoc ppr_sig :: forall (p :: Pass). OutputableBndrId p => Sig (GhcPass p) -> SDoc hsSigDoc :: Sig name -> SDoc isCompleteMatchSig :: LSig name -> Bool isSCCFunSig :: LSig name -> Bool isMinimalLSig :: LSig name -> Bool isInlineLSig :: LSig name -> Bool isPragLSig :: LSig name -> Bool isSpecInstLSig :: LSig name -> Bool isSpecLSig :: LSig name -> Bool isTypeLSig :: LSig name -> Bool isFixityLSig :: LSig name -> Bool isDefaultMethod :: TcSpecPrags -> Bool hasSpecPrags :: TcSpecPrags -> Bool noSpecPrags :: TcSpecPrags isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool isEmptyIPBindsPR :: forall (p :: Pass). HsIPBinds (GhcPass p) -> Bool pprTicks :: SDoc -> SDoc -> SDoc ppr_monobind :: forall (idL :: Pass) (idR :: Pass). (OutputableBndrId idL, OutputableBndrId idR) => HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc plusHsValBinds :: forall (a :: Pass). HsValBinds (GhcPass a) -> HsValBinds (GhcPass a) -> HsValBinds (GhcPass a) isEmptyLHsBinds :: LHsBindsLR idL idR -> Bool emptyLHsBinds :: LHsBindsLR idL idR emptyValBindsOut :: forall (a :: Pass) (b :: Pass). HsValBindsLR (GhcPass a) (GhcPass b) emptyValBindsIn :: forall (a :: Pass) (b :: Pass). HsValBindsLR (GhcPass a) (GhcPass b) isEmptyValBinds :: forall (a :: Pass) (b :: Pass). HsValBindsLR (GhcPass a) (GhcPass b) -> Bool eqEmptyLocalBinds :: HsLocalBindsLR a b -> Bool isEmptyLocalBindsPR :: forall (a :: Pass) (b :: Pass). HsLocalBindsLR (GhcPass a) (GhcPass b) -> Bool isEmptyLocalBindsTc :: forall (a :: Pass). HsLocalBindsLR (GhcPass a) GhcTc -> Bool emptyLocalBinds :: forall (a :: Pass) (b :: Pass). HsLocalBindsLR (GhcPass a) (GhcPass b) pprDeclList :: [SDoc] -> SDoc pprLHsBindsForUser :: forall (idL :: Pass) (idR :: Pass) (id2 :: Pass). (OutputableBndrId idL, OutputableBndrId idR, OutputableBndrId id2) => LHsBindsLR (GhcPass idL) (GhcPass idR) -> [LSig (GhcPass id2)] -> [SDoc] pprLHsBinds :: forall (idL :: Pass) (idR :: Pass). (OutputableBndrId idL, OutputableBndrId idR) => LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc -- | Haskell Local Bindings type HsLocalBinds id = HsLocalBindsLR id id -- | Located Haskell local bindings type LHsLocalBinds id = Located HsLocalBinds id -- | Haskell Local Bindings with separate Left and Right identifier types -- -- Bindings in a 'let' expression or a 'where' clause data HsLocalBindsLR idL idR -- | Haskell Value Bindings HsValBinds :: XHsValBinds idL idR -> HsValBindsLR idL idR -> HsLocalBindsLR idL idR -- | Haskell Implicit Parameter Bindings HsIPBinds :: XHsIPBinds idL idR -> HsIPBinds idR -> HsLocalBindsLR idL idR -- | Empty Local Bindings EmptyLocalBinds :: XEmptyLocalBinds idL idR -> HsLocalBindsLR idL idR XHsLocalBindsLR :: XXHsLocalBindsLR idL idR -> HsLocalBindsLR idL idR type LHsLocalBindsLR idL idR = Located HsLocalBindsLR idL idR -- | Haskell Value Bindings type HsValBinds id = HsValBindsLR id id -- | Haskell Value bindings with separate Left and Right identifier types -- (not implicit parameters) Used for both top level and nested bindings -- May contain pattern synonym bindings data HsValBindsLR idL idR -- | Value Bindings In -- -- Before renaming RHS; idR is always RdrName Not dependency analysed -- Recursive by default ValBinds :: XValBinds idL idR -> LHsBindsLR idL idR -> [LSig idR] -> HsValBindsLR idL idR -- | Value Bindings Out -- -- After renaming RHS; idR can be Name or Id Dependency analysed, later -- bindings in the list may depend on earlier ones. XValBindsLR :: XXValBindsLR idL idR -> HsValBindsLR idL idR data NHsValBindsLR idL NValBinds :: [(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL -- | Located Haskell Binding type LHsBind id = LHsBindLR id id -- | Located Haskell Bindings type LHsBinds id = LHsBindsLR id id -- | Haskell Binding type HsBind id = HsBindLR id id -- | Located Haskell Bindings with separate Left and Right identifier types type LHsBindsLR idL idR = Bag LHsBindLR idL idR -- | Located Haskell Binding with separate Left and Right identifier types type LHsBindLR idL idR = Located HsBindLR idL idR -- | Haskell Binding with separate Left and Right id's data HsBindLR idL idR -- | Function-like Binding -- -- FunBind is used for both functions f x = e and variables -- f = x -> e and strict variables !x = x + 1 -- -- Reason 1: Special case for type inference: see tcMonoBinds. -- -- Reason 2: Instance decls can only have FunBinds, which is convenient. -- If you change this, you'll need to change e.g. rnMethodBinds -- -- But note that the form f :: a->a = ... parses as a pattern -- binding, just like (f :: a -> a) = ... -- -- Strict bindings have their strictness recorded in the -- SrcStrictness of their MatchContext. See Note [FunBind -- vs PatBind] for details about the relationship between FunBind and -- PatBind. -- -- AnnKeywordIds -- -- FunBind :: XFunBind idL idR -> Located (IdP idL) -> MatchGroup idR (LHsExpr idR) -> HsWrapper -> [Tickish Id] -> HsBindLR idL idR -- | After the renamer, this contains the locally-bound free variables of -- this defn. See Note [Bind free vars] [fun_ext] :: HsBindLR idL idR -> XFunBind idL idR [fun_id] :: HsBindLR idL idR -> Located (IdP idL) -- | The payload [fun_matches] :: HsBindLR idL idR -> MatchGroup idR (LHsExpr idR) -- | Coercion from the type of the MatchGroup to the type of the Id. -- Example: -- --
--   f :: Int -> forall a. a -> a
--   f x y = y
--   
-- -- Then the MatchGroup will have type (Int -> a' -> a') (with a -- free type variable a'). The coercion will take a CoreExpr of this type -- and convert it to a CoreExpr of type Int -> forall a'. a' -> a' -- Notice that the coercion captures the free a'. [fun_co_fn] :: HsBindLR idL idR -> HsWrapper -- | Ticks to put on the rhs, if any [fun_tick] :: HsBindLR idL idR -> [Tickish Id] -- | Pattern Binding -- -- The pattern is never a simple variable; That case is done by FunBind. -- See Note [FunBind vs PatBind] for details about the relationship -- between FunBind and PatBind. PatBind :: XPatBind idL idR -> LPat idL -> GRHSs idR (LHsExpr idR) -> ([Tickish Id], [[Tickish Id]]) -> HsBindLR idL idR -- | See Note [Bind free vars] [pat_ext] :: HsBindLR idL idR -> XPatBind idL idR [pat_lhs] :: HsBindLR idL idR -> LPat idL [pat_rhs] :: HsBindLR idL idR -> GRHSs idR (LHsExpr idR) -- | Ticks to put on the rhs, if any, and ticks to put on the bound -- variables. [pat_ticks] :: HsBindLR idL idR -> ([Tickish Id], [[Tickish Id]]) -- | Variable Binding -- -- Dictionary binding and suchlike. All VarBinds are introduced by the -- type checker VarBind :: XVarBind idL idR -> IdP idL -> LHsExpr idR -> Bool -> HsBindLR idL idR [var_ext] :: HsBindLR idL idR -> XVarBind idL idR [var_id] :: HsBindLR idL idR -> IdP idL -- | Located only for consistency [var_rhs] :: HsBindLR idL idR -> LHsExpr idR -- | True = inline this binding regardless (used for implication -- constraints only) [var_inline] :: HsBindLR idL idR -> Bool -- | Abstraction Bindings AbsBinds :: XAbsBinds idL idR -> [TyVar] -> [EvVar] -> [ABExport idL] -> [TcEvBinds] -> LHsBinds idL -> Bool -> HsBindLR idL idR [abs_ext] :: HsBindLR idL idR -> XAbsBinds idL idR [abs_tvs] :: HsBindLR idL idR -> [TyVar] -- | Includes equality constraints [abs_ev_vars] :: HsBindLR idL idR -> [EvVar] -- | AbsBinds only gets used when idL = idR after renaming, but these need -- to be idL's for the collect... code in HsUtil to have the right type [abs_exports] :: HsBindLR idL idR -> [ABExport idL] -- | Evidence bindings Why a list? See TcInstDcls Note [Typechecking plan -- for instance declarations] [abs_ev_binds] :: HsBindLR idL idR -> [TcEvBinds] -- | Typechecked user bindings [abs_binds] :: HsBindLR idL idR -> LHsBinds idL [abs_sig] :: HsBindLR idL idR -> Bool -- | PatSynBind :: XPatSynBind idL idR -> PatSynBind idL idR -> HsBindLR idL idR XHsBindsLR :: XXHsBindsLR idL idR -> HsBindLR idL idR data NPatBindTc NPatBindTc :: NameSet -> Type -> NPatBindTc -- | Free variables [pat_fvs] :: NPatBindTc -> NameSet -- | Type of the GRHSs [pat_rhs_ty] :: NPatBindTc -> Type -- | Abtraction Bindings Export data ABExport p ABE :: XABE p -> IdP p -> IdP p -> HsWrapper -> TcSpecPrags -> ABExport p [abe_ext] :: ABExport p -> XABE p -- | Any INLINE pragma is attached to this Id [abe_poly] :: ABExport p -> IdP p [abe_mono] :: ABExport p -> IdP p -- | See Note [ABExport wrapper] Shape: (forall abs_tvs. abs_ev_vars => -- abe_mono) ~ abe_poly [abe_wrap] :: ABExport p -> HsWrapper -- | SPECIALISE pragmas [abe_prags] :: ABExport p -> TcSpecPrags XABExport :: XXABExport p -> ABExport p -- | -- -- Pattern Synonym binding data PatSynBind idL idR PSB :: XPSB idL idR -> Located (IdP idL) -> HsPatSynDetails (Located (IdP idR)) -> LPat idR -> HsPatSynDir idR -> PatSynBind idL idR -- | Post renaming, FVs. See Note [Bind free vars] [psb_ext] :: PatSynBind idL idR -> XPSB idL idR -- | Name of the pattern synonym [psb_id] :: PatSynBind idL idR -> Located (IdP idL) -- | Formal parameter names [psb_args] :: PatSynBind idL idR -> HsPatSynDetails (Located (IdP idR)) -- | Right-hand side [psb_def] :: PatSynBind idL idR -> LPat idR -- | Directionality [psb_dir] :: PatSynBind idL idR -> HsPatSynDir idR XPatSynBind :: XXPatSynBind idL idR -> PatSynBind idL idR -- | Haskell Implicit Parameter Bindings data HsIPBinds id IPBinds :: XIPBinds id -> [LIPBind id] -> HsIPBinds id XHsIPBinds :: XXHsIPBinds id -> HsIPBinds id -- | Located Implicit Parameter Binding -- -- May have AnnKeywordId : AnnSemi when in a list type LIPBind id = Located IPBind id -- | Implicit parameter bindings. -- -- These bindings start off as (Left "x") in the parser and stay that way -- until after type-checking when they are replaced with (Right d), where -- "d" is the name of the dictionary holding the evidence for the -- implicit parameter. -- -- data IPBind id IPBind :: XCIPBind id -> Either (Located HsIPName) (IdP id) -> LHsExpr id -> IPBind id XIPBind :: XXIPBind id -> IPBind id -- | Located Signature type LSig pass = Located Sig pass -- | Signatures and pragmas data Sig pass -- | An ordinary type signature -- --
--   f :: Num a => a -> a
--   
-- -- After renaming, this list of Names contains the named wildcards -- brought into scope by this signature. For a signature _ -> _a -- -> Bool, the renamer will leave the unnamed wildcard -- _ untouched, and the named wildcard _a is then -- replaced with fresh meta vars in the type. Their names are stored in -- the type signature that brought them into scope, in this third field -- to be more specific. -- -- TypeSig :: XTypeSig pass -> [Located (IdP pass)] -> LHsSigWcType pass -> Sig pass -- | A pattern synonym type signature -- --
--   pattern Single :: () => (Show a) => a -> [a]
--   
-- -- PatSynSig :: XPatSynSig pass -> [Located (IdP pass)] -> LHsSigType pass -> Sig pass -- | A signature for a class method False: ordinary class-method signature -- True: generic-default class method signature e.g. class C a where op -- :: a -> a -- Ordinary default op :: Eq a => a -> a -- Generic -- default No wildcards allowed here -- -- ClassOpSig :: XClassOpSig pass -> Bool -> [Located (IdP pass)] -> LHsSigType pass -> Sig pass -- | A type signature in generated code, notably the code generated for -- record selectors. We simply record the desired Id itself, replete with -- its name, type and IdDetails. Otherwise it's just like a type -- signature: there should be an accompanying binding IdSig :: XIdSig pass -> Id -> Sig pass -- | An ordinary fixity declaration -- --
--   infixl 8 ***
--   
-- -- FixSig :: XFixSig pass -> FixitySig pass -> Sig pass -- | An inline pragma -- --
--   {#- INLINE f #-}
--   
-- -- InlineSig :: XInlineSig pass -> Located (IdP pass) -> InlinePragma -> Sig pass -- | A specialisation pragma -- --
--   {-# SPECIALISE f :: Int -> Int #-}
--   
-- -- SpecSig :: XSpecSig pass -> Located (IdP pass) -> [LHsSigType pass] -> InlinePragma -> Sig pass -- | A specialisation pragma for instance declarations only -- --
--   {-# SPECIALISE instance Eq [Int] #-}
--   
-- -- (Class tys); should be a specialisation of the current instance -- declaration -- -- SpecInstSig :: XSpecInstSig pass -> SourceText -> LHsSigType pass -> Sig pass -- | A minimal complete definition pragma -- --
--   {-# MINIMAL a | (b, c | (d | e)) #-}
--   
-- -- MinimalSig :: XMinimalSig pass -> SourceText -> LBooleanFormula (Located (IdP pass)) -> Sig pass -- | A "set cost centre" pragma for declarations -- --
--   {-# SCC funName #-}
--   
-- -- or -- --
--   {-# SCC funName "cost_centre_name" #-}
--   
SCCFunSig :: XSCCFunSig pass -> SourceText -> Located (IdP pass) -> Maybe (Located StringLiteral) -> Sig pass -- | A complete match pragma -- --
--   {-# COMPLETE C, D [:: T] #-}
--   
-- -- Used to inform the pattern match checker about additional complete -- matchings which, for example, arise from pattern synonym definitions. CompleteMatchSig :: XCompleteMatchSig pass -> SourceText -> Located [Located (IdP pass)] -> Maybe (Located (IdP pass)) -> Sig pass XSig :: XXSig pass -> Sig pass -- | Located Fixity Signature type LFixitySig pass = Located FixitySig pass -- | Fixity Signature data FixitySig pass FixitySig :: XFixitySig pass -> [Located (IdP pass)] -> Fixity -> FixitySig pass XFixitySig :: XXFixitySig pass -> FixitySig pass -- | Type checker Specialisation Pragmas -- -- TcSpecPrags conveys SPECIALISE pragmas from the type -- checker to the desugarer data TcSpecPrags -- | Super-specialised: a default method should be macro-expanded at every -- call site IsDefaultMethod :: TcSpecPrags SpecPrags :: [LTcSpecPrag] -> TcSpecPrags -- | Located Type checker Specification Pragmas type LTcSpecPrag = Located TcSpecPrag -- | Type checker Specification Pragma data TcSpecPrag -- | The Id to be specialised, a wrapper that specialises the polymorphic -- function, and inlining spec for the specialised function SpecPrag :: Id -> HsWrapper -> InlinePragma -> TcSpecPrag -- | Haskell Pattern Synonym Details type HsPatSynDetails arg = HsConDetails arg [RecordPatSynField arg] -- | Record Pattern Synonym Field data RecordPatSynField a RecordPatSynField :: a -> a -> RecordPatSynField a [recordPatSynSelectorId] :: RecordPatSynField a -> a [recordPatSynPatVar] :: RecordPatSynField a -> a -- | Haskell Pattern Synonym Direction data HsPatSynDir id Unidirectional :: HsPatSynDir id ImplicitBidirectional :: HsPatSynDir id ExplicitBidirectional :: MatchGroup id (LHsExpr id) -> HsPatSynDir id instanceBindFun :: TyCoVar -> BindFlag -- | See Note [Rules for instance lookup] ^ See Note [Safe Haskell -- Overlapping Instances] in TcSimplify ^ See Note [Safe Haskell -- Overlapping Instances Implementation] in TcSimplify lookupInstEnv :: Bool -> InstEnvs -> Class -> [Type] -> ClsInstLookupResult -- | Look up an instance in the given instance environment. The given class -- application must match exactly one instance and the match may not -- contain any flexi type variables. If the lookup is unsuccessful, yield -- 'Left errorMessage'. lookupUniqueInstEnv :: InstEnvs -> Class -> [Type] -> Either MsgDoc (ClsInst, [Type]) -- | True when when the instance heads are the same e.g. both are Eq -- [(a,b)] Used for overriding in GHCi Obviously should be insenstive to -- alpha-renaming identicalClsInstHead :: ClsInst -> ClsInst -> Bool deleteDFunFromInstEnv :: InstEnv -> DFunId -> InstEnv deleteFromInstEnv :: InstEnv -> ClsInst -> InstEnv extendInstEnv :: InstEnv -> ClsInst -> InstEnv extendInstEnvList :: InstEnv -> [ClsInst] -> InstEnv -- | Checks for an exact match of ClsInst in the instance environment. We -- use this when we do signature checking in TcRnDriver memberInstEnv :: InstEnv -> ClsInst -> Bool classInstances :: InstEnvs -> Class -> [ClsInst] -- | Test if an instance is visible, by checking that its origin module is -- in VisibleOrphanModules. See Note [Instance lookup and orphan -- instances] instIsVisible :: VisibleOrphanModules -> ClsInst -> Bool instEnvClasses :: InstEnv -> [Class] instEnvElts :: InstEnv -> [ClsInst] emptyInstEnv :: InstEnv mkImportedInstance :: Name -> [Maybe Name] -> Name -> DFunId -> OverlapFlag -> IsOrphan -> ClsInst mkLocalInstance :: DFunId -> OverlapFlag -> [TyVar] -> Class -> [Type] -> ClsInst instanceSig :: ClsInst -> ([TyVar], [Type], Class, [Type]) -- | Collects the names of concrete types and type constructors that make -- up the head of a class instance. For instance, given `class Foo a b`: -- -- `instance Foo (Either (Maybe Int) a) Bool` would yield [Either, Maybe, -- Int, Bool] -- -- Used in the implementation of ":info" in GHCi. -- -- The tcSplitSigmaTy is because of instance Foo a => Baz T -- where ... The decl is an orphan if Baz and T are both not locally -- defined, even if Foo *is* locally defined orphNamesOfClsInst :: ClsInst -> NameSet instanceHead :: ClsInst -> ([TyVar], Class, [Type]) pprInstances :: [ClsInst] -> SDoc pprInstanceHdr :: ClsInst -> SDoc pprInstance :: ClsInst -> SDoc instanceRoughTcs :: ClsInst -> [Maybe Name] updateClsInstDFun :: (DFunId -> DFunId) -> ClsInst -> ClsInst instanceDFunId :: ClsInst -> DFunId isIncoherent :: ClsInst -> Bool isOverlapping :: ClsInst -> Bool isOverlappable :: ClsInst -> Bool -- | A fuzzy comparison function for class instances, intended for sorting -- instances before displaying them to the user. fuzzyClsInstCmp :: ClsInst -> ClsInst -> Ordering -- | A type-class instance. Note that there is some tricky laziness at work -- here. See Note [ClsInst laziness and the rough-match fields] for more -- details. data ClsInst ClsInst :: Name -> [Maybe Name] -> Name -> [TyVar] -> Class -> [Type] -> DFunId -> OverlapFlag -> IsOrphan -> ClsInst -- | Class name [is_cls_nm] :: ClsInst -> Name -- | Top of type args [is_tcs] :: ClsInst -> [Maybe Name] -- | is_dfun_name = idName . is_dfun. -- -- We use is_dfun_name for the visibility check, -- instIsVisible, which needs to know the Module which the -- dictionary is defined in. However, we cannot use the Module -- attached to is_dfun since doing so would mean we would -- potentially pull in an entire interface file unnecessarily. This was -- the cause of #12367. [is_dfun_name] :: ClsInst -> Name [is_tvs] :: ClsInst -> [TyVar] [is_cls] :: ClsInst -> Class [is_tys] :: ClsInst -> [Type] [is_dfun] :: ClsInst -> DFunId [is_flag] :: ClsInst -> OverlapFlag [is_orphan] :: ClsInst -> IsOrphan type InstEnv = UniqDFM ClsInstEnv -- | InstEnvs represents the combination of the global type class -- instance environment, the local type class instance environment, and -- the set of transitively reachable orphan modules (according to what -- modules have been directly imported) used to test orphan instance -- visibility. data InstEnvs InstEnvs :: InstEnv -> InstEnv -> VisibleOrphanModules -> InstEnvs [ie_global] :: InstEnvs -> InstEnv [ie_local] :: InstEnvs -> InstEnv [ie_visible] :: InstEnvs -> VisibleOrphanModules -- | Set of visible orphan modules, according to what modules have been -- directly imported. This is based off of the dep_orphs field, which -- records transitively reachable orphan modules (modules that define -- orphan instances). type VisibleOrphanModules = ModuleSet type DFunInstType = Maybe Type type InstMatch = (ClsInst, [DFunInstType]) type ClsInstLookupResult = ([InstMatch], [ClsInst], [InstMatch]) data FamInst -- | Information we can use to dynamically link modules into the compiler data Linkable LM :: UTCTime -> Module -> [Unlinked] -> Linkable -- | Time at which this linkable was built (i.e. when the bytecodes were -- produced, or the mod date on the files) [linkableTime] :: Linkable -> UTCTime -- | The linkable module itself [linkableModule] :: Linkable -> Module -- | Those files and chunks of code we have yet to link. -- -- INVARIANT: A valid linkable always has at least one Unlinked -- item. If this list is empty, the Linkable represents a fake linkable, -- which is generated in HscNothing mode to avoid recompiling modules. -- -- ToDo: Do items get removed from this list when they get linked? [linkableUnlinked] :: Linkable -> [Unlinked] -- | Objects which have yet to be linked by the compiler data Unlinked -- | An object file (.o) DotO :: FilePath -> Unlinked -- | Static archive file (.a) DotA :: FilePath -> Unlinked -- | Dynamically linked library file (.so, .dll, .dylib) DotDLL :: FilePath -> Unlinked -- | A byte-code object, lives only in memory. Also carries some static -- pointer table entries which should be loaded along with the BCOs. See -- Note [Grant plan for static forms] in StaticPtrTable. BCOs :: CompiledByteCode -> [SptEntry] -> Unlinked -- | An entry to be inserted into a module's static pointer table. See Note -- [Grand plan for static forms] in StaticPtrTable. data SptEntry SptEntry :: Id -> Fingerprint -> SptEntry -- | Construct an empty ModBreaks emptyModBreaks :: ModBreaks data CompiledByteCode -- | Breakpoint index type BreakIndex = Int -- | All the information about the breakpoints for a module data ModBreaks ModBreaks :: ForeignRef BreakArray -> !Array BreakIndex SrcSpan -> !Array BreakIndex [OccName] -> !Array BreakIndex [String] -> !Array BreakIndex (RemotePtr CostCentre) -> IntMap CgBreakInfo -> ModBreaks -- | The array of flags, one per breakpoint, indicating which breakpoints -- are enabled. [modBreaks_flags] :: ModBreaks -> ForeignRef BreakArray -- | An array giving the source span of each breakpoint. [modBreaks_locs] :: ModBreaks -> !Array BreakIndex SrcSpan -- | An array giving the names of the free variables at each breakpoint. [modBreaks_vars] :: ModBreaks -> !Array BreakIndex [OccName] -- | An array giving the names of the declarations enclosing each -- breakpoint. [modBreaks_decls] :: ModBreaks -> !Array BreakIndex [String] -- | Array pointing to cost centre for each breakpoint [modBreaks_ccs] :: ModBreaks -> !Array BreakIndex (RemotePtr CostCentre) -- | info about each breakpoint from the bytecode generator [modBreaks_breakInfo] :: ModBreaks -> IntMap CgBreakInfo -- | parenthesizeHsContext p ctxt checks if ctxt -- is a single constraint c such that -- hsTypeNeedsParens p c is true, and if so, surrounds -- c with an HsParTy to form a parenthesized -- ctxt. Otherwise, it simply returns ctxt unchanged. parenthesizeHsContext :: forall (p :: Pass). PprPrec -> LHsContext (GhcPass p) -> LHsContext (GhcPass p) -- | parenthesizeHsType p ty checks if -- hsTypeNeedsParens p ty is true, and if so, surrounds -- ty with an HsParTy. Otherwise, it simply returns -- ty. parenthesizeHsType :: forall (p :: Pass). PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p) -- | hsTypeNeedsParens p t returns True if the type -- t needs parentheses under precedence p. hsTypeNeedsParens :: PprPrec -> HsType pass -> Bool pprHsType :: forall (p :: Pass). OutputableBndrId p => HsType (GhcPass p) -> SDoc pprConDeclFields :: forall (p :: Pass). OutputableBndrId p => [LConDeclField (GhcPass p)] -> SDoc pprLHsContext :: forall (p :: Pass). OutputableBndrId p => LHsContext (GhcPass p) -> SDoc -- | Version of pprHsForAll or pprHsForAllExtra that will -- always print forall. when passed Just []. Prints -- nothing if passed Nothing pprHsExplicitForAll :: forall (p :: Pass). OutputableBndrId p => ForallVisFlag -> Maybe [LHsTyVarBndr (GhcPass p)] -> SDoc -- | Version of pprHsForAll that can also print an extra-constraints -- wildcard, e.g. _ => a -> Bool or (Show a, _) => -- a -> String. This underscore will be printed when the 'Maybe -- SrcSpan' argument is a Just containing the location of the -- extra-constraints wildcard. A special function for this is needed, as -- the extra-constraints wildcard is removed from the actual context and -- type, and stored in a separate field, thus just printing the type will -- not print the extra-constraints wildcard. pprHsForAllExtra :: forall (p :: Pass). OutputableBndrId p => Maybe SrcSpan -> ForallVisFlag -> [LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc -- | Prints a forall; When passed an empty list, prints forall -- ./forall -> only when -dppr-debug is -- enabled. pprHsForAll :: forall (p :: Pass). OutputableBndrId p => ForallVisFlag -> [LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc pprAnonWildCard :: SDoc ambiguousFieldOcc :: FieldOcc GhcTc -> AmbiguousFieldOcc GhcTc unambiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> FieldOcc GhcTc selectorAmbiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> Id rdrNameAmbiguousFieldOcc :: forall (p :: Pass). AmbiguousFieldOcc (GhcPass p) -> RdrName mkAmbiguousFieldOcc :: Located RdrName -> AmbiguousFieldOcc GhcPs mkFieldOcc :: Located RdrName -> FieldOcc GhcPs getLHsInstDeclClass_maybe :: forall (p :: Pass). LHsSigType (GhcPass p) -> Maybe (Located (IdP (GhcPass p))) getLHsInstDeclHead :: forall (p :: Pass). LHsSigType (GhcPass p) -> LHsType (GhcPass p) -- | Decompose a type class instance type (of the form forall -- tvs. context => instance_head) into its constituent -- parts. -- -- Note that this function looks through parentheses, so it will work on -- types such as (forall tvs. ...). The downside -- to this is that it is not generally possible to take the returned -- types and reconstruct the original type (parentheses and all) from -- them. splitLHsInstDeclTy :: LHsSigType GhcRn -> ([Name], LHsContext GhcRn, LHsType GhcRn) -- | Decompose a type of the form context => body into its -- constituent parts. -- -- Note that this function looks through parentheses, so it will work on -- types such as (context => ...). The downside to -- this is that it is not generally possible to take the returned types -- and reconstruct the original type (parentheses and all) from them. splitLHsQualTy :: LHsType pass -> (LHsContext pass, LHsType pass) -- | Decompose a type of the form forall tvs. body into its -- constituent parts. Note that only invisible foralls -- (i.e., forall a., with a dot) are split apart; visible -- foralls (i.e., forall a ->, with an arrow) are -- left untouched. -- -- This function is used to split apart certain types, such as instance -- declaration types, which disallow visible foralls. For -- instance, if GHC split apart the forall in instance -- forall a -> Show (Blah a), then that declaration would -- mistakenly be accepted! -- -- Note that this function looks through parentheses, so it will work on -- types such as (forall a. ...). The downside to this is -- that it is not generally possible to take the returned types and -- reconstruct the original type (parentheses and all) from them. splitLHsForAllTyInvis :: LHsType pass -> ([LHsTyVarBndr pass], LHsType pass) -- | Decompose a sigma type (of the form forall tvs. context -- => body) into its constituent parts. Note that only -- invisible foralls (i.e., forall a., with a -- dot) are split apart; visible foralls (i.e., -- forall a ->, with an arrow) are left untouched. -- -- This function is used to split apart certain types, such as instance -- declaration types, which disallow visible foralls. For -- instance, if GHC split apart the forall in instance -- forall a -> Show (Blah a), then that declaration would -- mistakenly be accepted! -- -- Note that this function looks through parentheses, so it will work on -- types such as (forall a. ...). The downside to this is -- that it is not generally possible to take the returned types and -- reconstruct the original type (parentheses and all) from them. splitLHsSigmaTyInvis :: LHsType pass -> ([LHsTyVarBndr pass], LHsContext pass, LHsType pass) -- | Decompose a pattern synonym type signature into its constituent parts. -- -- Note that this function looks through parentheses, so it will work on -- types such as (forall a. ...). The downside to this is -- that it is not generally possible to take the returned types and -- reconstruct the original type (parentheses and all) from them. splitLHsPatSynTy :: LHsType pass -> ([LHsTyVarBndr pass], LHsContext pass, [LHsTyVarBndr pass], LHsContext pass, LHsType pass) numVisibleArgs :: [HsArg tm ty] -> Arity hsTyGetAppHead_maybe :: forall (p :: Pass). LHsType (GhcPass p) -> Maybe (Located (IdP (GhcPass p))) splitHsFunType :: LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn) mkHsAppKindTy :: forall (p :: Pass). XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) mkHsAppTys :: forall (p :: Pass). LHsType (GhcPass p) -> [LHsType (GhcPass p)] -> LHsType (GhcPass p) mkHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) mkHsOpTy :: forall (p :: Pass). LHsType (GhcPass p) -> Located (IdP (GhcPass p)) -> LHsType (GhcPass p) -> HsType (GhcPass p) mkAnonWildCardTy :: HsType GhcPs isLHsForAllTy :: LHsType p -> Bool ignoreParens :: LHsType pass -> LHsType pass -- | Get the kind signature of a type, ignoring parentheses: -- -- hsTyKindSig `Maybe ` = Nothing hsTyKindSig `Maybe :: Type -> Type ` -- = Just `Type -> Type` hsTyKindSig `Maybe :: ((Type -> Type))` = -- Just `Type -> Type` -- -- This is used to extract the result kind of type synonyms with a CUSK: -- -- type S = (F :: res_kind) ^^^^^^^^ hsTyKindSig :: LHsType pass -> Maybe (LHsKind pass) -- | Convert a LHsTyVarBndrs to a list of types. Works on *type* variable -- only, no kind vars. hsLTyVarBndrsToTypes :: forall (p :: Pass). LHsQTyVars (GhcPass p) -> [LHsType (GhcPass p)] -- | Convert a LHsTyVarBndr to an equivalent LHsType. hsLTyVarBndrToType :: forall (p :: Pass). LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p) hsLTyVarLocNames :: forall (p :: Pass). LHsQTyVars (GhcPass p) -> [Located (IdP (GhcPass p))] hsLTyVarLocName :: forall (p :: Pass). LHsTyVarBndr (GhcPass p) -> Located (IdP (GhcPass p)) hsAllLTyVarNames :: LHsQTyVars GhcRn -> [Name] hsExplicitLTyVarNames :: forall (p :: Pass). LHsQTyVars (GhcPass p) -> [IdP (GhcPass p)] hsLTyVarNames :: forall (p :: Pass). [LHsTyVarBndr (GhcPass p)] -> [IdP (GhcPass p)] hsLTyVarName :: forall (p :: Pass). LHsTyVarBndr (GhcPass p) -> IdP (GhcPass p) hsTyVarName :: forall (p :: Pass). HsTyVarBndr (GhcPass p) -> IdP (GhcPass p) hsScopedTvs :: LHsSigType GhcRn -> [Name] hsWcScopedTvs :: LHsSigWcType GhcRn -> [Name] hsConDetailsArgs :: HsConDetails (LHsType a) (Located [LConDeclField a]) -> [LHsType a] -- | Do all type variables in this LHsQTyVars come with kind -- annotations? hsTvbAllKinded :: LHsQTyVars pass -> Bool -- | Does this HsTyVarBndr come with an explicit kind annotation? isHsKindedTyVar :: HsTyVarBndr pass -> Bool hsIPNameFS :: HsIPName -> FastString mkEmptyWildCardBndrs :: thing -> HsWildCardBndrs GhcRn thing mkEmptyImplicitBndrs :: thing -> HsImplicitBndrs GhcRn thing mkHsWildCardBndrs :: thing -> HsWildCardBndrs GhcPs thing mkHsImplicitBndrs :: thing -> HsImplicitBndrs GhcPs thing dropWildCards :: LHsSigWcType pass -> LHsSigType pass hsSigWcType :: LHsSigWcType pass -> LHsType pass hsSigType :: forall (p :: Pass). LHsSigType (GhcPass p) -> LHsType (GhcPass p) hsImplicitBody :: forall (p :: Pass) thing. HsImplicitBndrs (GhcPass p) thing -> thing isEmptyLHsQTvs :: LHsQTyVars GhcRn -> Bool emptyLHsQTvs :: LHsQTyVars GhcRn hsQTvExplicit :: LHsQTyVars pass -> [LHsTyVarBndr pass] mkHsQTvs :: [LHsTyVarBndr GhcPs] -> LHsQTyVars GhcPs noLHsContext :: LHsContext pass getBangStrictness :: LHsType a -> HsSrcBang getBangType :: LHsType a -> LHsType a -- | Located Bang Type type LBangType pass = Located BangType pass -- | Bang Type -- -- In the parser, strictness and packedness annotations bind more tightly -- than docstrings. This means that when consuming a BangType (and -- looking for HsBangTy) we must be ready to peer behind a -- potential layer of HsDocTy. See #15206 for motivation and -- getBangType for an example. type BangType pass = HsType pass -- | Located Haskell Context type LHsContext pass = Located HsContext pass -- | Haskell Context type HsContext pass = [LHsType pass] -- | Located Haskell Type type LHsType pass = Located HsType pass -- | Haskell Kind type HsKind pass = HsType pass -- | Located Haskell Kind type LHsKind pass = Located HsKind pass -- | Located Haskell Type Variable Binder type LHsTyVarBndr pass = Located HsTyVarBndr pass -- | Located Haskell Quantified Type Variables data LHsQTyVars pass HsQTvs :: XHsQTvs pass -> [LHsTyVarBndr pass] -> LHsQTyVars pass [hsq_ext] :: LHsQTyVars pass -> XHsQTvs pass [hsq_explicit] :: LHsQTyVars pass -> [LHsTyVarBndr pass] XLHsQTyVars :: XXLHsQTyVars pass -> LHsQTyVars pass -- | Haskell Implicit Binders data HsImplicitBndrs pass thing HsIB :: XHsIB pass thing -> thing -> HsImplicitBndrs pass thing [hsib_ext] :: HsImplicitBndrs pass thing -> XHsIB pass thing [hsib_body] :: HsImplicitBndrs pass thing -> thing XHsImplicitBndrs :: XXHsImplicitBndrs pass thing -> HsImplicitBndrs pass thing -- | Haskell Wildcard Binders data HsWildCardBndrs pass thing HsWC :: XHsWC pass thing -> thing -> HsWildCardBndrs pass thing [hswc_ext] :: HsWildCardBndrs pass thing -> XHsWC pass thing [hswc_body] :: HsWildCardBndrs pass thing -> thing XHsWildCardBndrs :: XXHsWildCardBndrs pass thing -> HsWildCardBndrs pass thing -- | Located Haskell Signature Type type LHsSigType pass = HsImplicitBndrs pass LHsType pass -- | Located Haskell Wildcard Type type LHsWcType pass = HsWildCardBndrs pass LHsType pass -- | Located Haskell Signature Wildcard Type type LHsSigWcType pass = HsWildCardBndrs pass LHsSigType pass -- | These names are used early on to store the names of implicit -- parameters. They completely disappear after type-checking. newtype HsIPName HsIPName :: FastString -> HsIPName -- | Haskell Type Variable Binder data HsTyVarBndr pass UserTyVar :: XUserTyVar pass -> Located (IdP pass) -> HsTyVarBndr pass -- | KindedTyVar :: XKindedTyVar pass -> Located (IdP pass) -> LHsKind pass -> HsTyVarBndr pass XTyVarBndr :: XXTyVarBndr pass -> HsTyVarBndr pass -- | Haskell Type data HsType pass -- | HsForAllTy :: XForAllTy pass -> ForallVisFlag -> [LHsTyVarBndr pass] -> LHsType pass -> HsType pass [hst_xforall] :: HsType pass -> XForAllTy pass [hst_fvf] :: HsType pass -> ForallVisFlag [hst_bndrs] :: HsType pass -> [LHsTyVarBndr pass] [hst_body] :: HsType pass -> LHsType pass HsQualTy :: XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass [hst_xqual] :: HsType pass -> XQualTy pass [hst_ctxt] :: HsType pass -> LHsContext pass [hst_body] :: HsType pass -> LHsType pass -- | HsTyVar :: XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass -- | HsAppTy :: XAppTy pass -> LHsType pass -> LHsType pass -> HsType pass HsAppKindTy :: XAppKindTy pass -> LHsType pass -> LHsKind pass -> HsType pass -- | HsFunTy :: XFunTy pass -> LHsType pass -> LHsType pass -> HsType pass -- | HsListTy :: XListTy pass -> LHsType pass -> HsType pass -- | HsTupleTy :: XTupleTy pass -> HsTupleSort -> [LHsType pass] -> HsType pass -- | HsSumTy :: XSumTy pass -> [LHsType pass] -> HsType pass -- | HsOpTy :: XOpTy pass -> LHsType pass -> Located (IdP pass) -> LHsType pass -> HsType pass -- | HsParTy :: XParTy pass -> LHsType pass -> HsType pass -- |
--   (?x :: ty)
--   
-- -- HsIParamTy :: XIParamTy pass -> Located HsIPName -> LHsType pass -> HsType pass -- | HsStarTy :: XStarTy pass -> Bool -> HsType pass -- |
--   (ty :: kind)
--   
-- -- HsKindSig :: XKindSig pass -> LHsType pass -> LHsKind pass -> HsType pass -- | HsSpliceTy :: XSpliceTy pass -> HsSplice pass -> HsType pass -- | HsDocTy :: XDocTy pass -> LHsType pass -> LHsDocString -> HsType pass -- | HsBangTy :: XBangTy pass -> HsSrcBang -> LHsType pass -> HsType pass -- | HsRecTy :: XRecTy pass -> [LConDeclField pass] -> HsType pass -- | HsExplicitListTy :: XExplicitListTy pass -> PromotionFlag -> [LHsType pass] -> HsType pass -- | HsExplicitTupleTy :: XExplicitTupleTy pass -> [LHsType pass] -> HsType pass -- | HsTyLit :: XTyLit pass -> HsTyLit -> HsType pass -- | HsWildCardTy :: XWildCardTy pass -> HsType pass XHsType :: XXType pass -> HsType pass data NewHsTypeX NHsCoreTy :: Type -> NewHsTypeX -- | Haskell Type Literal data HsTyLit HsNumTy :: SourceText -> Integer -> HsTyLit HsStrTy :: SourceText -> FastString -> HsTyLit -- | Haskell Tuple Sort data HsTupleSort HsUnboxedTuple :: HsTupleSort HsBoxedTuple :: HsTupleSort HsConstraintTuple :: HsTupleSort HsBoxedOrConstraintTuple :: HsTupleSort -- | Located Constructor Declaration Field type LConDeclField pass = Located ConDeclField pass -- | Constructor Declaration Field data ConDeclField pass -- | ConDeclField :: XConDeclField pass -> [LFieldOcc pass] -> LBangType pass -> Maybe LHsDocString -> ConDeclField pass [cd_fld_ext] :: ConDeclField pass -> XConDeclField pass -- | See Note [ConDeclField passs] [cd_fld_names] :: ConDeclField pass -> [LFieldOcc pass] [cd_fld_type] :: ConDeclField pass -> LBangType pass [cd_fld_doc] :: ConDeclField pass -> Maybe LHsDocString XConDeclField :: XXConDeclField pass -> ConDeclField pass -- | Haskell Constructor Details data HsConDetails arg rec PrefixCon :: [arg] -> HsConDetails arg rec RecCon :: rec -> HsConDetails arg rec InfixCon :: arg -> arg -> HsConDetails arg rec data HsArg tm ty HsValArg :: tm -> HsArg tm ty HsTypeArg :: SrcSpan -> ty -> HsArg tm ty HsArgPar :: SrcSpan -> HsArg tm ty type LHsTypeArg p = HsArg LHsType p LHsKind p -- | Located Field Occurrence type LFieldOcc pass = Located FieldOcc pass -- | Field Occurrence -- -- Represents an *occurrence* of an unambiguous field. We store both the -- RdrName the user originally wrote, and after the renamer, the -- selector function. data FieldOcc pass FieldOcc :: XCFieldOcc pass -> Located RdrName -> FieldOcc pass [extFieldOcc] :: FieldOcc pass -> XCFieldOcc pass -- | See Note [Located RdrNames] in GHC.Hs.Expr [rdrNameFieldOcc] :: FieldOcc pass -> Located RdrName XFieldOcc :: XXFieldOcc pass -> FieldOcc pass -- | Ambiguous Field Occurrence -- -- Represents an *occurrence* of a field that is potentially ambiguous -- after the renamer, with the ambiguity resolved by the typechecker. We -- always store the RdrName that the user originally wrote, and -- store the selector function after the renamer (for unambiguous -- occurrences) or the typechecker (for ambiguous occurrences). -- -- See Note [HsRecField and HsRecUpdField] in GHC.Hs.Pat and Note -- [Disambiguating record fields] in TcExpr. See Note [Located RdrNames] -- in GHC.Hs.Expr data AmbiguousFieldOcc pass Unambiguous :: XUnambiguous pass -> Located RdrName -> AmbiguousFieldOcc pass Ambiguous :: XAmbiguous pass -> Located RdrName -> AmbiguousFieldOcc pass XAmbiguousFieldOcc :: XXAmbiguousFieldOcc pass -> AmbiguousFieldOcc pass data ExecOptions ExecOptions :: SingleStep -> String -> Int -> (ForeignHValue -> EvalExpr ForeignHValue) -> ExecOptions -- | stepping mode [execSingleStep] :: ExecOptions -> SingleStep -- | filename (for errors) [execSourceFile] :: ExecOptions -> String -- | line number (for errors) [execLineNumber] :: ExecOptions -> Int [execWrap] :: ExecOptions -> ForeignHValue -> EvalExpr ForeignHValue data SingleStep RunToCompletion :: SingleStep SingleStep :: SingleStep RunAndLogSteps :: SingleStep data ExecResult ExecComplete :: Either SomeException [Name] -> Word64 -> ExecResult [execResult] :: ExecResult -> Either SomeException [Name] [execAllocation] :: ExecResult -> Word64 ExecBreak :: [Name] -> Maybe BreakInfo -> ExecResult [breakNames] :: ExecResult -> [Name] [breakInfo] :: ExecResult -> Maybe BreakInfo data BreakInfo data Resume Resume :: String -> ForeignRef (ResumeContext [HValueRef]) -> ([TyThing], GlobalRdrEnv) -> [Id] -> ForeignHValue -> Maybe BreakInfo -> SrcSpan -> String -> RemotePtr CostCentreStack -> [History] -> Int -> Resume [resumeStmt] :: Resume -> String [resumeContext] :: Resume -> ForeignRef (ResumeContext [HValueRef]) [resumeBindings] :: Resume -> ([TyThing], GlobalRdrEnv) [resumeFinalIds] :: Resume -> [Id] [resumeApStack] :: Resume -> ForeignHValue [resumeBreakInfo] :: Resume -> Maybe BreakInfo [resumeSpan] :: Resume -> SrcSpan [resumeDecl] :: Resume -> String [resumeCCS] :: Resume -> RemotePtr CostCentreStack [resumeHistory] :: Resume -> [History] [resumeHistoryIx] :: Resume -> Int data History promotedNilDataCon :: TyCon promotedConsDataCon :: TyCon promotedGTDataCon :: TyCon promotedEQDataCon :: TyCon promotedLTDataCon :: TyCon promotedJustDataCon :: TyCon promotedNothingDataCon :: TyCon promotedFalseDataCon :: TyCon promotedTrueDataCon :: TyCon mkSumTy :: [Type] -> Type -- | Make a tuple type. The list of types should not include any -- RuntimeRep specifications. Boxed 1-tuples are *not* flattened. See -- Note [One-tuples] and Note [Don't flatten tuples from HsSyn] in MkCore mkTupleTy1 :: Boxity -> [Type] -> Type -- | Make a tuple type. The list of types should not include any -- RuntimeRep specifications. Boxed 1-tuples are flattened. See Note -- [One-tuples] mkTupleTy :: Boxity -> [Type] -> Type justDataCon :: DataCon nothingDataCon :: DataCon maybeTyCon :: TyCon consDataCon :: DataCon nilDataCon :: DataCon mkListTy :: Type -> Type ordGTDataConId :: Id ordEQDataConId :: Id ordLTDataConId :: Id ordGTDataCon :: DataCon ordEQDataCon :: DataCon ordLTDataCon :: DataCon orderingTyCon :: TyCon trueDataConId :: Id falseDataConId :: Id trueDataCon :: DataCon falseDataCon :: DataCon boolTyCon :: TyCon boolTy :: Type doubleDataCon :: DataCon doubleTyCon :: TyCon doubleTy :: Type floatDataCon :: DataCon floatTyCon :: TyCon floatTy :: Type word8DataCon :: DataCon word8TyCon :: TyCon word8Ty :: Type wordDataCon :: DataCon wordTyCon :: TyCon wordTy :: Type intDataCon :: DataCon intTyCon :: TyCon intTy :: Type stringTy :: Type charDataCon :: DataCon charTyCon :: TyCon charTy :: Type boxingDataCon_maybe :: TyCon -> Maybe DataCon liftedRepTy :: Type liftedRepDataCon :: DataCon sumRepDataConTyCon :: TyCon liftedTypeKindTyCon :: TyCon coercibleDataCon :: DataCon coercibleClass :: Class heqDataCon :: DataCon heqClass :: Class eqDataCon :: DataCon eqClass :: Class eqTyCon :: TyCon -- | Specialization of unboxedTupleSumKind for sums unboxedSumKind :: [Type] -> Kind -- | Data constructor for i-th alternative of a n-ary unboxed sum. sumDataCon :: ConTag -> Arity -> DataCon -- | Type constructor for n-ary unboxed sum. sumTyCon :: Arity -> TyCon unboxedUnitDataCon :: DataCon unboxedUnitTyCon :: TyCon pairTyCon :: TyCon unitDataConId :: Id unitDataCon :: DataCon unitTyConKey :: Unique unitTyCon :: TyCon tupleDataConName :: Boxity -> Arity -> Name tupleDataCon :: Boxity -> Arity -> DataCon promotedTupleDataCon :: Boxity -> Arity -> TyCon tupleTyCon :: Boxity -> Arity -> TyCon cTupleDataConNames :: [Name] cTupleDataConName :: Arity -> Name -- | If the given name is that of a constraint tuple, return its arity. -- Note that this is inefficient. cTupleTyConNameArity_maybe :: Name -> Maybe Arity isCTupleTyConName :: Name -> Bool cTupleTyConNames :: [Name] cTupleTyConName :: Arity -> Name mkTupleStr :: Boxity -> Arity -> String -- | Built-in syntax isn't "in scope" so these OccNames map to wired-in -- Names with BuiltInSyntax. However, this should only be necessary while -- resolving names produced by Template Haskell splices since we take -- care to encode built-in syntax names specially in interface files. See -- Note [Symbol table representation of names]. -- -- Moreover, there is no need to include names of things that the user -- can't write (e.g. type representation bindings like $tc(,,,)). isBuiltInOcc_maybe :: OccName -> Maybe Name typeToTypeKind :: Kind constraintKindTyCon :: TyCon typeSymbolKindCon :: TyCon typeNatKindCon :: TyCon consDataCon_RDR :: RdrName listTyCon_RDR :: RdrName intDataCon_RDR :: RdrName charTyCon_RDR :: RdrName intTyCon_RDR :: RdrName true_RDR :: RdrName false_RDR :: RdrName boolTyCon_RDR :: RdrName liftedTypeKindTyConName :: Name constraintKindTyConName :: Name -- | Make a fake, recovery TyCon from an existing one. Used when -- recovering from errors in type declarations makeRecoveryTyCon :: TyCon -> TyCon anyTy :: Type anyTyCon :: TyCon doubleTyConName :: Name floatTyConName :: Name word8TyConName :: Name wordTyConName :: Name justDataConName :: Name nothingDataConName :: Name maybeTyConName :: Name consDataConName :: Name nilDataConName :: Name listTyConName :: Name boolTyConName :: Name intTyConName :: Name charTyConName :: Name coercibleTyConName :: Name heqTyConName :: Name eqTyCon_RDR :: RdrName eqTyConName :: Name mkWiredInIdName :: Module -> FastString -> Unique -> Id -> Name mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name wiredInTyCons :: [TyCon] isNeverLevPolyId :: Id -> Bool transferPolyIdInfo :: Id -> [Var] -> Id -> Id zapStableUnfolding :: Id -> Id zapIdTailCallInfo :: Id -> Id zapIdUsedOnceInfo :: Id -> Id zapIdUsageEnvInfo :: Id -> Id zapIdUsageInfo :: Id -> Id zapIdDemandInfo :: Id -> Id zapFragileIdInfo :: Id -> Id zapLamIdInfo :: Id -> Id updOneShotInfo :: Id -> OneShotInfo -> Id setIdOneShotInfo :: Id -> OneShotInfo -> Id infixl 1 `setIdOneShotInfo` clearOneShotLambda :: Id -> Id setOneShotLambda :: Id -> Id isProbablyOneShotLambda :: Id -> Bool isStateHackType :: Type -> Bool typeOneShot :: Type -> OneShotInfo -- | Should we apply the state hack to values of this Type? stateHackOneShot :: OneShotInfo -- | Returns whether the lambda associated with the Id is certainly -- applied at most once This one is the "business end", called -- externally. It works on type variables as well as Ids, returning True -- Its main purpose is to encapsulate the Horrible State Hack See Note -- [The state-transformer hack] in CoreArity isOneShotBndr :: Var -> Bool -- | Like idOneShotInfo, but taking the Horrible State Hack in to -- account See Note [The state-transformer hack] in CoreArity idStateHackOneShotInfo :: Id -> OneShotInfo idOneShotInfo :: Id -> OneShotInfo isConLikeId :: Id -> Bool idRuleMatchInfo :: Id -> RuleMatchInfo setInlineActivation :: Id -> Activation -> Id infixl 1 `setInlineActivation` idInlineActivation :: Id -> Activation modifyInlinePragma :: Id -> (InlinePragma -> InlinePragma) -> Id setInlinePragma :: Id -> InlinePragma -> Id infixl 1 `setInlinePragma` idInlinePragma :: Id -> InlinePragma zapIdOccInfo :: Id -> Id setIdOccInfo :: Id -> OccInfo -> Id infixl 1 `setIdOccInfo` idOccInfo :: Id -> OccInfo setIdCafInfo :: Id -> CafInfo -> Id idCafInfo :: Id -> CafInfo infixl 1 `idCafInfo` setIdSpecialisation :: Id -> RuleInfo -> Id infixl 1 `setIdSpecialisation` idHasRules :: Id -> Bool idCoreRules :: Id -> [CoreRule] idSpecialisation :: Id -> RuleInfo setCaseBndrEvald :: StrictnessMark -> Id -> Id setIdDemandInfo :: Id -> Demand -> Id infixl 1 `setIdDemandInfo` idDemandInfo :: Id -> Demand setIdUnfolding :: Id -> Unfolding -> Id infixl 1 `setIdUnfolding` realIdUnfolding :: Id -> Unfolding idUnfolding :: Id -> Unfolding -- | This predicate says whether the Id has a strict demand placed -- on it or has a type such that it can always be evaluated strictly (i.e -- an unlifted type, as of GHC 7.6). We need to check separately whether -- the Id has a so-called "strict type" because if the demand for -- the given id hasn't been computed yet but id has a -- strict type, we still want isStrictId id to be True. isStrictId :: Id -> Bool zapIdStrictness :: Id -> Id setIdStrictness :: Id -> StrictSig -> Id infixl 1 `setIdStrictness` -- | Accesses the Id's strictnessInfo. idStrictness :: Id -> StrictSig -- | Returns true if an application to n args would diverge isBottomingId :: Var -> Bool idFunRepArity :: Id -> RepArity setIdCallArity :: Id -> Arity -> Id infixl 1 `setIdCallArity` idCallArity :: Id -> Arity setIdArity :: Id -> Arity -> Id infixl 1 `setIdArity` idArity :: Id -> Arity asJoinId_maybe :: Id -> Maybe JoinArity -> Id infixl 1 `asJoinId_maybe` zapJoinId :: Id -> Id asJoinId :: Id -> JoinArity -> JoinId infixl 1 `asJoinId` idJoinArity :: JoinId -> JoinArity isDeadBinder :: Id -> Bool idIsFrom :: Module -> Id -> Bool -- | isImplicitId tells whether an Ids info is implied by -- other declarations, so we don't need to put its signature in an -- interface file, even if it's mentioned in some other interface -- unfolding. isImplicitId :: Id -> Bool -- | Returns True of an Id which may not have a binding, -- even though it is defined in this module. hasNoBinding :: Id -> Bool -- | Get from either the worker or the wrapper Id to the -- DataCon. Currently used only in the desugarer. -- -- INVARIANT: idDataCon (dataConWrapId d) = d: remember, -- dataConWrapId can return either the wrapper or the worker idDataCon :: Id -> DataCon isJoinId_maybe :: Var -> Maybe JoinArity isJoinId :: Var -> Bool isDataConId_maybe :: Id -> Maybe DataCon isDataConWrapId_maybe :: Id -> Maybe DataCon isDataConWrapId :: Id -> Bool isDataConWorkId_maybe :: Id -> Maybe DataCon isDataConWorkId :: Id -> Bool isFCallId_maybe :: Id -> Maybe ForeignCall isFCallId :: Id -> Bool isPrimOpId_maybe :: Id -> Maybe PrimOp isDFunId :: Id -> Bool isPrimOpId :: Id -> Bool isClassOpId_maybe :: Id -> Maybe Class isNaughtyRecordSelector :: Id -> Bool isPatSynRecordSelector :: Id -> Bool isDataConRecordSelector :: Id -> Bool isRecordSelector :: Id -> Bool -- | If the Id is that for a record selector, extract the -- sel_tycon. Panic otherwise. recordSelectorTyCon :: Id -> RecSelParent -- | Create a template local for a series of type, but start from a -- specified template local mkTemplateLocalsNum :: Int -> [Type] -> [Id] -- | Create a template local for a series of types mkTemplateLocals :: [Type] -> [Id] -- | Create a template local: a family of system local Ids in -- bijection with Ints, typically used in unfoldings mkTemplateLocal :: Int -> Type -> Id -- | Workers get local names. CoreTidy will externalise these if -- necessary mkWorkerId :: Unique -> Id -> Type -> Id -- | Like mkUserLocal, but checks if we have a coercion type mkUserLocalOrCoVar :: OccName -> Unique -> Type -> SrcSpan -> Id -- | Create a user local Id. These are local Ids (see -- Var#globalvslocal) with a name and location that the user might -- recognize mkUserLocal :: OccName -> Unique -> Type -> SrcSpan -> Id mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Type -> m Id mkSysLocalM :: MonadUnique m => FastString -> Type -> m Id -- | Like mkSysLocal, but checks to see if we have a covar type mkSysLocalOrCoVar :: FastString -> Unique -> Type -> Id -- | Create a system local Id. These are local Ids (see -- Var#globalvslocal) that are created by the compiler out of thin -- air mkSysLocal :: FastString -> Unique -> Type -> Id mkExportedVanillaId :: Name -> Type -> Id -- | Create a local Id that is marked as exported. This prevents -- things attached to it from being removed as dead code. See Note -- [Exported LocalIds] mkExportedLocalId :: IdDetails -> Name -> Type -> Id mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id -- | Make a local id, with the IdDetails set to CoVarId if the type -- indicates so. mkLocalIdOrCoVarWithInfo :: Name -> Type -> IdInfo -> Id -- | Like mkLocalId, but checks the type to see if it should make a -- covar mkLocalIdOrCoVar :: Name -> Type -> Id -- | Make a local CoVar mkLocalCoVar :: Name -> Type -> CoVar -- | For an explanation of global vs. local Ids, see -- Var#globalvslocal mkLocalId :: Name -> Type -> Id -- | Make a global Id with no global information but some generic -- IdInfo mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id -- | Make a global Id without any extra information at all mkVanillaGlobal :: Name -> Type -> Id -- | For an explanation of global vs. local Ids, see -- Var#globalvslocal mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id modifyIdInfo :: HasDebugCallStack => (IdInfo -> IdInfo) -> Id -> Id setIdInfo :: Id -> IdInfo -> Id localiseId :: Id -> Id -- | Not only does this set the Id Type, it also evaluates -- the type to try and reduce space usage setIdType :: Id -> Type -> Id setIdUnique :: Id -> Unique -> Id setIdName :: Id -> Name -> Id idType :: Id -> Kind idUnique :: Id -> Unique idName :: Id -> Name -- | As collectNBinders but for AnnExpr rather than -- Expr collectNAnnBndrs :: Int -> AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot) -- | As collectBinders but for AnnExpr rather than -- Expr collectAnnBndrs :: AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot) deAnnBind :: AnnBind b annot -> Bind b deAnnAlt :: AnnAlt bndr annot -> Alt bndr deAnnotate' :: AnnExpr' bndr annot -> Expr bndr deAnnotate :: AnnExpr bndr annot -> Expr bndr collectAnnArgsTicks :: (Tickish Var -> Bool) -> AnnExpr b a -> (AnnExpr b a, [AnnExpr b a], [Tickish Var]) -- | Takes a nested application expression and returns the function being -- applied and the arguments to which it is applied collectAnnArgs :: AnnExpr b a -> (AnnExpr b a, [AnnExpr b a]) -- | The number of argument expressions that are values rather than types -- at their top level valArgCount :: [Arg b] -> Int -- | The number of binders that bind values rather than types valBndrCount :: [CoreBndr] -> Int -- | Returns True iff the expression is a Type expression -- at its top level. Note this does NOT include Coercions. isTypeArg :: Expr b -> Bool -- | Returns True iff the expression is a Coercion -- expression at its top level isCoArg :: Expr b -> Bool -- | Returns True iff the expression is a Type or -- Coercion expression at its top level isTyCoArg :: Expr b -> Bool -- | Returns True for value arguments, false for type args NB: -- coercions are value arguments (zero width, to be sure, like State#, -- but still value args). isValArg :: Expr b -> Bool -- | Will this argument expression exist at runtime? isRuntimeArg :: CoreExpr -> Bool -- | Will this variable exist at runtime? isRuntimeVar :: Var -> Bool -- | Like collectArgs, but also collects looks through floatable -- ticks if it means that we can find more arguments. collectArgsTicks :: (Tickish Id -> Bool) -> Expr b -> (Expr b, [Arg b], [Tickish Id]) -- | Attempt to remove the last N arguments of a function call. Strip off -- any ticks or coercions encountered along the way and any at the end. stripNArgs :: Word -> Expr a -> Maybe (Expr a) -- | Takes a nested application expression and returns the function being -- applied and the arguments to which it is applied collectArgs :: Expr b -> (Expr b, [Arg b]) -- | Strip off exactly N leading lambdas (type or value). Good for use with -- join points. collectNBinders :: Int -> Expr b -> ([b], Expr b) collectTyAndValBinders :: CoreExpr -> ([TyVar], [Id], CoreExpr) collectTyBinders :: CoreExpr -> ([TyVar], CoreExpr) -- | We often want to strip off leading lambdas before getting down to -- business. Variants are collectTyBinders, -- collectValBinders, and collectTyAndValBinders collectBinders :: Expr b -> ([b], Expr b) -- | Collapse all the bindings in the supplied groups into a single list of -- lhs/rhs pairs suitable for binding in a Rec binding group flattenBinds :: [Bind b] -> [(b, Expr b)] rhssOfAlts :: [Alt b] -> [Expr b] rhssOfBind :: Bind b -> [Expr b] -- | bindersOf applied to a list of binding groups bindersOfBinds :: [Bind b] -> [b] -- | Extract every variable by this group bindersOf :: Bind b -> [b] -- | If the expression is a Coercion, converts. exprToCoercion_maybe :: CoreExpr -> Maybe Coercion -- | If the expression is a Type, converts. Otherwise, panics. NB: -- This does not convert Coercion to CoercionTy. exprToType :: CoreExpr -> Type -- | Determines the type resulting from applying an expression with given -- type to a given argument expression applyTypeToArg :: Type -> CoreExpr -> Type varsToCoreExprs :: [CoreBndr] -> [Expr b] -- | Convert a binder into either a Var or Type Expr -- appropriately varToCoreExpr :: CoreBndr -> Expr b -- | Create a binding group where a type variable is bound to a type. Per -- CoreSyn#type_let, this can only be used to bind something in a -- non-recursive let expression mkCoBind :: CoVar -> Coercion -> CoreBind -- | Create a binding group where a type variable is bound to a type. Per -- CoreSyn#type_let, this can only be used to bind something in a -- non-recursive let expression mkTyBind :: TyVar -> Type -> CoreBind -- | mkLetRec binds body wraps body in a let rec -- with the given set of binds if binds is non-empty. mkLetRec :: [(b, Expr b)] -> Expr b -> Expr b -- | mkLetNonRec bndr rhs body wraps body in a -- let binding bndr. mkLetNonRec :: b -> Expr b -> Expr b -> Expr b mkLet :: Bind b -> Expr b -> Expr b -- | Bind all supplied binding groups over an expression in a nested let -- expression. Assumes that the rhs satisfies the let/app invariant. -- Prefer to use mkCoreLets if possible, which does guarantee the -- invariant mkLets :: [Bind b] -> Expr b -> Expr b -- | Bind all supplied binders over an expression in a nested lambda -- expression. Prefer to use mkCoreLams if possible mkLams :: [b] -> Expr b -> Expr b -- | Create a machine double precision literal expression of type -- Double# from a Double. If you want an expression of -- type Double use mkDoubleExpr mkDoubleLitDouble :: Double -> Expr b -- | Create a machine double precision literal expression of type -- Double# from a Rational. If you want an expression -- of type Double use mkDoubleExpr mkDoubleLit :: Rational -> Expr b -- | Create a machine single precision literal expression of type -- Float# from a Float. If you want an expression of -- type Float use mkFloatExpr mkFloatLitFloat :: Float -> Expr b -- | Create a machine single precision literal expression of type -- Float# from a Rational. If you want an expression of -- type Float use mkFloatExpr mkFloatLit :: Rational -> Expr b -- | Create a machine string literal expression of type Addr#. If -- you want an expression of type String use mkStringExpr mkStringLit :: String -> Expr b -- | Create a machine character literal expression of type Char#. -- If you want an expression of type Char use mkCharExpr mkCharLit :: Char -> Expr b mkInt64LitInt64 :: Int64 -> Expr b mkWord64LitWord64 :: Word64 -> Expr b -- | Create a machine word literal expression of type Word# from a -- Word. If you want an expression of type Word use -- mkWordExpr mkWordLitWord :: DynFlags -> Word -> Expr b -- | Create a machine word literal expression of type Word# from -- an Integer. If you want an expression of type Word -- use mkWordExpr mkWordLit :: DynFlags -> Integer -> Expr b -- | Create a machine integer literal expression of type Int# from -- an Int. If you want an expression of type Int use -- mkIntExpr mkIntLitInt :: DynFlags -> Int -> Expr b -- | Create a machine integer literal expression of type Int# from -- an Integer. If you want an expression of type Int -- use mkIntExpr mkIntLit :: DynFlags -> Integer -> Expr b mkTyArg :: Type -> Expr b mkConApp2 :: DataCon -> [Type] -> [Var] -> Expr b -- | Apply a list of type argument expressions to a function expression in -- a nested fashion mkTyApps :: Expr b -> [Type] -> Expr b infixl 4 `mkTyApps` -- | Apply a list of argument expressions to a data constructor in a nested -- fashion. Prefer to use mkCoreConApps if possible mkConApp :: DataCon -> [Arg b] -> Expr b -- | Apply a list of type or value variables to a function expression in a -- nested fashion mkVarApps :: Expr b -> [Var] -> Expr b infixl 4 `mkVarApps` -- | Apply a list of coercion argument expressions to a function expression -- in a nested fashion mkCoApps :: Expr b -> [Coercion] -> Expr b infixl 4 `mkCoApps` -- | Apply a list of argument expressions to a function expression in a -- nested fashion. Prefer to use mkCoreApps if possible mkApps :: Expr b -> [Arg b] -> Expr b infixl 4 `mkApps` deTagExpr :: TaggedExpr t -> CoreExpr -- | Compares AltCons within a single list of alternatives DEFAULT -- comes out smallest, so that sorting by AltCon puts alternatives in the -- order required: see Note [Case expression invariants] cmpAltCon :: AltCon -> AltCon -> Ordering ltAlt :: (AltCon, a, b) -> (AltCon, a, b) -> Bool cmpAlt :: (AltCon, a, b) -> (AltCon, a, b) -> Ordering canUnfold :: Unfolding -> Bool isFragileUnfolding :: Unfolding -> Bool neverUnfoldGuidance :: UnfoldingGuidance -> Bool isBootUnfolding :: Unfolding -> Bool -- | Only returns False if there is no unfolding information available at -- all hasSomeUnfolding :: Unfolding -> Bool isStableUnfolding :: Unfolding -> Bool isCompulsoryUnfolding :: Unfolding -> Bool expandUnfolding_maybe :: Unfolding -> Maybe CoreExpr isExpandableUnfolding :: Unfolding -> Bool -- | Is the thing we will unfold into certainly cheap? isCheapUnfolding :: Unfolding -> Bool -- | True if the unfolding is a constructor application, the -- application of a CONLIKE function or OtherCon isConLikeUnfolding :: Unfolding -> Bool -- | Determines if it possibly the case that the unfolding will yield a -- value. Unlike isValueUnfolding it returns True for -- OtherCon isEvaldUnfolding :: Unfolding -> Bool -- | Determines if it is certainly the case that the unfolding will yield a -- value (something in HNF): returns False if unsure isValueUnfolding :: Unfolding -> Bool -- | The constructors that the unfolding could never be: returns -- [] if no information is available otherCons :: Unfolding -> [AltCon] -- | Retrieves the template of an unfolding if possible -- maybeUnfoldingTemplate is used mainly wnen specialising, and we do -- want to specialise DFuns, so it's important to return a template for -- DFunUnfoldings maybeUnfoldingTemplate :: Unfolding -> Maybe CoreExpr -- | Retrieves the template of an unfolding: panics if none is known unfoldingTemplate :: Unfolding -> CoreExpr isStableSource :: UnfoldingSource -> Bool mkOtherCon :: [AltCon] -> Unfolding -- | There is no known Unfolding, because this came from an hi-boot -- file. bootUnfolding :: Unfolding -- | This unfolding marks the associated thing as being evaluated evaldUnfolding :: Unfolding -- | There is no known Unfolding noUnfolding :: Unfolding boringCxtNotOk :: Bool boringCxtOk :: Bool unSaturatedOk :: Bool needSaturated :: Bool -- | Set the Name of the Id at the head of the rule left hand -- side setRuleIdName :: Name -> CoreRule -> CoreRule isLocalRule :: CoreRule -> Bool -- | The Name of the Id at the head of the rule left hand -- side ruleIdName :: CoreRule -> Name ruleActivation :: CoreRule -> Activation ruleModule :: CoreRule -> Maybe Module ruleName :: CoreRule -> RuleName -- | The number of arguments the ru_fn must be applied to before the -- rule can match on it ruleArity :: CoreRule -> Int isAutoRule :: CoreRule -> Bool isBuiltinRule :: CoreRule -> Bool emptyRuleEnv :: RuleEnv mkRuleEnv :: RuleBase -> [Module] -> RuleEnv chooseOrphanAnchor :: NameSet -> IsOrphan -- | Returns true if IsOrphan is not an orphan. notOrphan :: IsOrphan -> Bool -- | Returns true if IsOrphan is orphan. isOrphan :: IsOrphan -> Bool -- | Returns whether one tick "contains" the other one, therefore making -- the second tick redundant. tickishContains :: Eq b => Tickish b -> Tickish b -> Bool -- | Placement behaviour we want for the ticks tickishPlace :: Tickish id -> TickishPlacement -- | Return True if this source annotation compiles to some -- backend code. Without this flag, the tickish is seen as a simple -- annotation that does not have any associated evaluation code. -- -- What this means that we are allowed to disregard the tick if doing so -- means that we can skip generating any code in the first place. A -- typical example is top-level bindings: -- -- foo = tick... y -> ... ==> foo = y -> tick... -- ... -- -- Here there is just no operational difference between the first and the -- second version. Therefore code generation should simply translate the -- code as if it found the latter. tickishIsCode :: Tickish id -> Bool mkNoScope :: Tickish id -> Tickish id mkNoCount :: Tickish id -> Tickish id -- | Returns True for a tick that is both counting and -- scoping and can be split into its (tick, scope) parts using -- mkNoScope and mkNoTick respectively. tickishCanSplit :: Tickish id -> Bool -- | Returns True for ticks that can be floated upwards easily -- even where it might change execution counts, such as: -- -- Just (tick... foo) ==> tick... (Just foo) -- -- This is a combination of tickishSoftScope and -- tickishCounts. Note that in principle splittable ticks can -- become floatable using mkNoTick -- even though there's -- currently no tickish for which that is the case. tickishFloatable :: Tickish id -> Bool -- | Returns whether the tick scoping rule is at least as permissive as the -- given scoping rule. tickishScopesLike :: Tickish id -> TickishScoping -> Bool -- | Returns the intended scoping rule for a Tickish tickishScoped :: Tickish id -> TickishScoping -- | A "counting tick" (where tickishCounts is True) is one that counts -- evaluations in some way. We cannot discard a counting tick, and the -- compiler should preserve the number of counting ticks as far as -- possible. -- -- However, we still allow the simplifier to increase or decrease -- sharing, so in practice the actual number of ticks may vary, except -- that we never change the value from zero to non-zero or vice versa. tickishCounts :: Tickish id -> Bool -- | This is the data type that represents GHCs core intermediate language. -- Currently GHC uses System FC -- https://www.microsoft.com/en-us/research/publication/system-f-with-type-equality-coercions/ -- for this purpose, which is closely related to the simpler and better -- known System F http://en.wikipedia.org/wiki/System_F. -- -- We get from Haskell source to this Core language in a number of -- stages: -- --
    --
  1. The source code is parsed into an abstract syntax tree, which is -- represented by the data type HsExpr with the names being -- RdrNames
  2. --
  3. This syntax tree is renamed, which attaches a Unique -- to every RdrName (yielding a Name) to disambiguate -- identifiers which are lexically identical. For example, this -- program:
  4. --
-- --
--   f x = let f x = x + 1
--         in f (x - 2)
--   
-- -- Would be renamed by having Uniques attached so it looked -- something like this: -- --
--   f_1 x_2 = let f_3 x_4 = x_4 + 1
--             in f_3 (x_2 - 2)
--   
-- -- But see Note [Shadowing] below. -- --
    --
  1. The resulting syntax tree undergoes type checking (which also -- deals with instantiating type class arguments) to yield a -- HsExpr type that has Id as it's names.
  2. --
  3. Finally the syntax tree is desugared from the expressive -- HsExpr type into this Expr type, which has far fewer -- constructors and hence is easier to perform optimization, analysis and -- code generation on.
  4. --
-- -- The type parameter b is for the type of binders in the -- expression tree. -- -- The language consists of the following elements: -- -- -- -- See Note [CoreSyn letrec invariant] See Note [CoreSyn let/app -- invariant] See Note [Levity polymorphism invariants] See Note [CoreSyn -- type and coercion invariant] -- -- -- -- The binder gets bound to the value of the scrutinee, and the -- Type must be that of all the case alternatives -- -- IMPORTANT: see Note [Case expression invariants] -- -- data Expr b Var :: Id -> Expr b Lit :: Literal -> Expr b App :: Expr b -> Arg b -> Expr b Lam :: b -> Expr b -> Expr b Let :: Bind b -> Expr b -> Expr b Case :: Expr b -> b -> Type -> [Alt b] -> Expr b Cast :: Expr b -> Coercion -> Expr b Tick :: Tickish Id -> Expr b -> Expr b Type :: Type -> Expr b Coercion :: Coercion -> Expr b infixl 4 `App` -- | Type synonym for expressions that occur in function argument -- positions. Only Arg should contain a Type at top level, -- general Expr should not type Arg b = Expr b -- | A case split alternative. Consists of the constructor leading to the -- alternative, the variables bound from the constructor, and the -- expression to be executed given that binding. The default alternative -- is (DEFAULT, [], rhs) type Alt b = (AltCon, [b], Expr b) -- | A case alternative constructor (i.e. pattern match) data AltCon DataAlt :: DataCon -> AltCon -- | A literal: case e of { 1 -> ... } Invariant: always an -- *unlifted* literal See Note [Literal alternatives] LitAlt :: Literal -> AltCon -- | Trivial alternative: case e of { _ -> ... } DEFAULT :: AltCon -- | Binding, used for top level bindings in a module and local bindings in -- a let. data Bind b NonRec :: b -> Expr b -> Bind b Rec :: [(b, Expr b)] -> Bind b type InBndr = CoreBndr type InType = Type type InKind = Kind type InBind = CoreBind type InExpr = CoreExpr type InAlt = CoreAlt type InArg = CoreArg type InCoercion = Coercion type OutBndr = CoreBndr type OutType = Type type OutKind = Kind type OutCoercion = Coercion type OutBind = CoreBind type OutExpr = CoreExpr type OutAlt = CoreAlt type OutArg = CoreArg type MOutCoercion = MCoercion -- | Allows attaching extra information to points in expressions data Tickish id -- | An {--} profiling annotation, either automatically added by -- the desugarer as a result of -auto-all, or added by the user. ProfNote :: CostCentre -> !Bool -> !Bool -> Tickish id -- | the cost centre [profNoteCC] :: Tickish id -> CostCentre -- | bump the entry count? [profNoteCount] :: Tickish id -> !Bool -- | scopes over the enclosed expression (i.e. not just a tick) [profNoteScope] :: Tickish id -> !Bool -- | A "tick" used by HPC to track the execution of each subexpression in -- the original source code. HpcTick :: Module -> !Int -> Tickish id [tickModule] :: Tickish id -> Module [tickId] :: Tickish id -> !Int -- | A breakpoint for the GHCi debugger. This behaves like an HPC tick, but -- has a list of free variables which will be available for inspection in -- GHCi when the program stops at the breakpoint. -- -- NB. we must take account of these Ids when (a) counting free -- variables, and (b) substituting (don't substitute for them) Breakpoint :: !Int -> [id] -> Tickish id [breakpointId] :: Tickish id -> !Int -- | the order of this list is important: it matches the order of the lists -- in the appropriate entry in HscTypes.ModBreaks. -- -- Careful about substitution! See Note [substTickish] in CoreSubst. [breakpointFVs] :: Tickish id -> [id] -- | A source note. -- -- Source notes are pure annotations: Their presence should neither -- influence compilation nor execution. The semantics are given by -- causality: The presence of a source note means that a local change in -- the referenced source code span will possibly provoke the generated -- code to change. On the flip-side, the functionality of annotated code -- *must* be invariant against changes to all source code *except* the -- spans referenced in the source notes (see "Causality of optimized -- Haskell" paper for details). -- -- Therefore extending the scope of any given source note is always -- valid. Note that it is still undesirable though, as this reduces their -- usefulness for debugging and profiling. Therefore we will generally -- try only to make use of this property where it is necessary to enable -- optimizations. SourceNote :: RealSrcSpan -> String -> Tickish id -- | Source covered [sourceSpan] :: Tickish id -> RealSrcSpan -- | Name for source location (uses same names as CCs) [sourceName] :: Tickish id -> String -- | Specifies the scoping behaviour of ticks. This governs the behaviour -- of ticks that care about the covered code and the cost associated with -- it. Important for ticks relating to profiling. data TickishScoping -- | No scoping: The tick does not care about what code it covers. -- Transformations can freely move code inside as well as outside without -- any additional annotation obligations NoScope :: TickishScoping -- | Soft scoping: We want all code that is covered to stay covered. Note -- that this scope type does not forbid transformations from happening, -- as long as all results of the transformations are still covered by -- this tick or a copy of it. For example -- -- let x = tick... (let y = foo in bar) in baz ===> let x = -- tick... bar; y = tick... foo in baz -- -- Is a valid transformation as far as "bar" and "foo" is concerned, -- because both still are scoped over by the tick. -- -- Note though that one might object to the "let" not being covered by -- the tick any more. However, we are generally lax with this - constant -- costs don't matter too much, and given that the "let" was effectively -- merged we can view it as having lost its identity anyway. -- -- Also note that this scoping behaviour allows floating a tick "upwards" -- in pretty much any situation. For example: -- -- case foo of x -> tick... bar ==> tick... case foo -- of x -> bar -- -- While this is always leagl, we want to make a best effort to only make -- us of this where it exposes transformation opportunities. SoftScope :: TickishScoping -- | Cost centre scoping: We don't want any costs to move to other -- cost-centre stacks. This means we not only want no code or cost to get -- moved out of their cost centres, but we also object to code getting -- associated with new cost-centre ticks - or changing the order in which -- they get applied. -- -- A rule of thumb is that we don't want any code to gain new -- annotations. However, there are notable exceptions, for example: -- -- let f = y -> foo in tick... ... (f x) ... ==> -- tick... ... foo[x/y] ... -- -- In-lining lambdas like this is always legal, because inlining a -- function does not change the cost-centre stack when the function is -- called. CostCentreScope :: TickishScoping -- | Governs the kind of expression that the tick gets placed on when -- annotating for example using mkTick. If we find that we want -- to put a tickish on an expression ruled out here, we try to float it -- inwards until we find a suitable expression. data TickishPlacement -- | Place ticks exactly on run-time expressions. We can still move the -- tick through pure compile-time constructs such as other ticks, casts -- or type lambdas. This is the most restrictive placement rule for -- ticks, as all tickishs have in common that they want to track runtime -- processes. The only legal placement rule for counting ticks. PlaceRuntime :: TickishPlacement -- | As PlaceRuntime, but we float the tick through all lambdas. -- This makes sense where there is little difference between annotating -- the lambda and annotating the lambda's code. PlaceNonLam :: TickishPlacement -- | In addition to floating through lambdas, cost-centre style tickishs -- can also be moved from constructors, non-function variables and -- literals. For example: -- -- let x = scc... C (scc... y) (scc... 3) in ... -- -- Neither the constructor application, the variable or the literal are -- likely to have any cost worth mentioning. And even if y names a thunk, -- the call would not care about the evaluation context. Therefore -- removing all annotations in the above example is safe. PlaceCostCentre :: TickishPlacement -- | Is this instance an orphan? If it is not an orphan, contains an -- OccName witnessing the instance's non-orphanhood. See Note -- [Orphans] data IsOrphan IsOrphan :: IsOrphan NotOrphan :: OccName -> IsOrphan -- | Gathers a collection of CoreRules. Maps (the name of) an -- Id to its rules type RuleBase = NameEnv [CoreRule] -- | A full rule environment which we can apply rules from. Like a -- RuleBase, but it also includes the set of visible orphans we -- use to filter out orphan rules which are not visible (even though we -- can see them...) data RuleEnv RuleEnv :: RuleBase -> ModuleSet -> RuleEnv [re_base] :: RuleEnv -> RuleBase [re_visible_orphs] :: RuleEnv -> ModuleSet -- | A CoreRule is: -- -- data CoreRule Rule :: RuleName -> Activation -> Name -> [Maybe Name] -> [CoreBndr] -> [CoreExpr] -> CoreExpr -> Bool -> !Module -> !IsOrphan -> Bool -> CoreRule -- | Name of the rule, for communication with the user [ru_name] :: CoreRule -> RuleName -- | When the rule is active [ru_act] :: CoreRule -> Activation -- | Name of the Id at the head of this rule [ru_fn] :: CoreRule -> Name -- | Name at the head of each argument to the left hand side [ru_rough] :: CoreRule -> [Maybe Name] -- | Variables quantified over [ru_bndrs] :: CoreRule -> [CoreBndr] -- | Left hand side arguments [ru_args] :: CoreRule -> [CoreExpr] -- | Right hand side of the rule Occurrence info is guaranteed correct See -- Note [OccInfo in unfoldings and rules] [ru_rhs] :: CoreRule -> CoreExpr -- | True = this rule is auto-generated (notably by -- Specialise or SpecConstr) False = generated at the -- user's behest See Note [Trimming auto-rules] in TidyPgm for the sole -- purpose of this field. [ru_auto] :: CoreRule -> Bool -- | Module the rule was defined in, used to test if we should see -- an orphan rule. [ru_origin] :: CoreRule -> !Module -- | Whether or not the rule is an orphan. [ru_orphan] :: CoreRule -> !IsOrphan -- | True iff the fn at the head of the rule is defined in the -- same module as the rule and is not an implicit Id (like a -- record selector, class operation, or data constructor). This is -- different from ru_orphan, where a rule can avoid being an -- orphan if *any* Name in LHS of the rule was defined in the same module -- as the rule. [ru_local] :: CoreRule -> Bool -- | Built-in rules are used for constant folding and suchlike. They have -- no free variables. A built-in rule is always visible (there is no such -- thing as an orphan built-in rule.) BuiltinRule :: RuleName -> Name -> Int -> RuleFun -> CoreRule -- | Name of the rule, for communication with the user [ru_name] :: CoreRule -> RuleName -- | Name of the Id at the head of this rule [ru_fn] :: CoreRule -> Name -- | Number of arguments that ru_try consumes, if it fires, -- including type arguments [ru_nargs] :: CoreRule -> Int -- | This function does the rewrite. It given too many arguments, it simply -- discards them; the returned CoreExpr is just the rewrite of -- ru_fn applied to the first ru_nargs args [ru_try] :: CoreRule -> RuleFun type RuleFun = DynFlags -> InScopeEnv -> Id -> [CoreExpr] -> Maybe CoreExpr type InScopeEnv = (InScopeSet, IdUnfoldingFun) type IdUnfoldingFun = Id -> Unfolding -- | Records the unfolding of an identifier, which is approximately -- the form the identifier would have if we substituted its definition in -- for the identifier. This type should be treated as abstract everywhere -- except in CoreUnfold data Unfolding -- | We have no information about the unfolding. NoUnfolding :: Unfolding -- | We have no information about the unfolding, because this Id -- came from an hi-boot file. See Note [Inlining and hs-boot -- files] in ToIface for what this is used for. BootUnfolding :: Unfolding -- | It ain't one of these constructors. OtherCon xs also -- indicates that something has been evaluated and hence there's no point -- in re-evaluating it. OtherCon [] is used even for -- non-data-type values to indicated evaluated-ness. Notably: -- --
--   data C = C !(Int -> Int)
--   case x of { C f -> ... }
--   
-- -- Here, f gets an OtherCon [] unfolding. OtherCon :: [AltCon] -> Unfolding DFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding [df_bndrs] :: Unfolding -> [Var] [df_con] :: Unfolding -> DataCon [df_args] :: Unfolding -> [CoreExpr] -- | An unfolding with redundant cached information. Parameters: -- -- uf_tmpl: Template used to perform unfolding; NB: Occurrence info is -- guaranteed correct: see Note [OccInfo in unfoldings and rules] -- -- uf_is_top: Is this a top level binding? -- -- uf_is_value: exprIsHNF template (cached); it is ok to discard -- a seq on this variable -- -- uf_is_work_free: Does this waste only a little work if we expand it -- inside an inlining? Basically this is a cached version of -- exprIsWorkFree -- -- uf_guidance: Tells us about the size of the unfolding template CoreUnfolding :: CoreExpr -> UnfoldingSource -> Bool -> Bool -> Bool -> Bool -> Bool -> UnfoldingGuidance -> Unfolding [uf_tmpl] :: Unfolding -> CoreExpr [uf_src] :: Unfolding -> UnfoldingSource [uf_is_top] :: Unfolding -> Bool [uf_is_value] :: Unfolding -> Bool [uf_is_conlike] :: Unfolding -> Bool [uf_is_work_free] :: Unfolding -> Bool [uf_expandable] :: Unfolding -> Bool [uf_guidance] :: Unfolding -> UnfoldingGuidance data UnfoldingSource InlineRhs :: UnfoldingSource InlineStable :: UnfoldingSource InlineCompulsory :: UnfoldingSource -- | UnfoldingGuidance says when unfolding should take place data UnfoldingGuidance UnfWhen :: Arity -> Bool -> Bool -> UnfoldingGuidance [ug_arity] :: UnfoldingGuidance -> Arity [ug_unsat_ok] :: UnfoldingGuidance -> Bool [ug_boring_ok] :: UnfoldingGuidance -> Bool UnfIfGoodArgs :: [Int] -> Int -> Int -> UnfoldingGuidance [ug_args] :: UnfoldingGuidance -> [Int] [ug_size] :: UnfoldingGuidance -> Int [ug_res] :: UnfoldingGuidance -> Int UnfNever :: UnfoldingGuidance type CoreProgram = [CoreBind] -- | The common case for the type of binders and variables when we are -- manipulating the Core language within GHC type CoreBndr = Var -- | Expressions where binders are CoreBndrs type CoreExpr = Expr CoreBndr -- | Argument expressions where binders are CoreBndrs type CoreArg = Arg CoreBndr -- | Binding groups where binders are CoreBndrs type CoreBind = Bind CoreBndr -- | Case alternatives where binders are CoreBndrs type CoreAlt = Alt CoreBndr -- | Binders are tagged with a t data TaggedBndr t TB :: CoreBndr -> t -> TaggedBndr t type TaggedBind t = Bind TaggedBndr t type TaggedExpr t = Expr TaggedBndr t type TaggedArg t = Arg TaggedBndr t type TaggedAlt t = Alt TaggedBndr t -- | A clone of the Alt type but allowing annotation at every tree -- node type AnnAlt bndr annot = (AltCon, [bndr], AnnExpr bndr annot) -- | A clone of the Bind type but allowing annotation at every tree -- node data AnnBind bndr annot AnnNonRec :: bndr -> AnnExpr bndr annot -> AnnBind bndr annot conLikeIsInfix :: ConLike -> Bool -- | The ConLikes that have *all* the given fields conLikesWithFields :: [ConLike] -> [FieldLabelString] -> [ConLike] -- | Extract the type for any given labelled field of the ConLike conLikeFieldType :: ConLike -> FieldLabelString -> Type -- | The "full signature" of the ConLike returns, in order: -- -- 1) The universally quantified type variables -- -- 2) The existentially quantified type/coercion variables -- -- 3) The equality specification -- -- 4) The provided theta (the constraints provided by a match) -- -- 5) The required theta (the constraints required for a match) -- -- 6) The original argument types (i.e. before any change of the -- representation of the type) -- -- 7) The original result type conLikeFullSig :: ConLike -> ([TyVar], [TyCoVar], [EqSpec], ThetaType, ThetaType, [Type], Type) -- | Returns the type of the whole pattern conLikeResTy :: ConLike -> [Type] -> Type -- | Returns the strictness information for each constructor conLikeImplBangs :: ConLike -> [HsImplBang] -- | Returns the Id of the wrapper. This is also known as the -- builder in some contexts. The value is Nothing only in the case of -- unidirectional pattern synonyms. conLikeWrapId_maybe :: ConLike -> Maybe Id -- | The "stupid theta" of the ConLike, such as data Eq a -- in: -- --
--   data Eq a => T a = ...
--   
-- -- It is empty for PatSynCon as they do not allow such contexts. conLikeStupidTheta :: ConLike -> ThetaType -- | Existentially quantified type/coercion variables conLikeExTyCoVars :: ConLike -> [TyCoVar] -- | Returns just the instantiated value argument types of a -- ConLike, (excluding dictionary args) conLikeInstOrigArgTys :: ConLike -> [Type] -> [Type] -- | Names of fields used for selectors conLikeFieldLabels :: ConLike -> [FieldLabel] -- | Number of arguments conLikeArity :: ConLike -> Arity buildSynTyCon :: Name -> [KnotTied TyConBinder] -> Kind -> [Role] -> KnotTied Type -> TyCon buildAlgTyCon :: Name -> [TyVar] -> [Role] -> Maybe CType -> ThetaType -> AlgTyConRhs -> Bool -> AlgTyConFlav -> TyCon -- | Extract the type constructor, type argument, data constructor and it's -- representation argument types from a type if it is a product -- type. -- -- Precisely, we return Just for any type that is all of: -- -- -- -- Whether the type is a data type or a newtype splitDataProductType_maybe :: Type -> Maybe (TyCon, [Type], DataCon, [Type]) promoteDataCon :: DataCon -> TyCon -- | Were the type variables of the data con written in a different order -- than the regular order (universal tyvars followed by existential -- tyvars)? -- -- This is not a cheap test, so we minimize its use in GHC as much as -- possible. Currently, its only call site in the GHC codebase is in -- mkDataConRep in MkId, and so -- dataConUserTyVarsArePermuted is only called at most once during -- a data constructor's lifetime. dataConUserTyVarsArePermuted :: DataCon -> Bool dataConCannotMatch :: [Type] -> DataCon -> Bool classDataCon :: Class -> DataCon -- | Should this DataCon be allowed in a type even without -XDataKinds? -- Currently, only Lifted & Unlifted specialPromotedDc :: DataCon -> Bool -- | Vanilla DataCons are those that are nice boring Haskell 98 -- constructors isVanillaDataCon :: DataCon -> Bool isUnboxedTupleCon :: DataCon -> Bool isTupleDataCon :: DataCon -> Bool -- | The string package:module.name identifying a constructor, -- which is attached to its info table and used by the GHCi debugger and -- the heap profiler dataConIdentity :: DataCon -> ByteString -- | Returns the arg types of the worker, including *all* non-dependent -- evidence, after any flattening has been done and without substituting -- for any type variables dataConRepArgTys :: DataCon -> [Type] -- | Returns the argument types of the wrapper, excluding all dictionary -- arguments and without substituting for any type variables dataConOrigArgTys :: DataCon -> [Type] -- | Finds the instantiated types of the arguments required to construct a -- DataCon representation NB: these INCLUDE any dictionary args -- but EXCLUDE the data-declaration context, which is discarded It's all -- post-flattening etc; this is a representation type dataConInstArgTys :: DataCon -> [Type] -> [Type] -- | The user-declared type of the data constructor in the nice-to-read -- form: -- --
--   T :: forall a b. a -> b -> T [a]
--   
-- -- rather than: -- --
--   T :: forall a c. forall b. (c~[a]) => a -> b -> T c
--   
-- -- The type variables are quantified in the order that the user wrote -- them. See Note [DataCon user type variable binders]. -- -- NB: If the constructor is part of a data instance, the result type -- mentions the family tycon, not the internal one. dataConUserType :: DataCon -> Type dataConOrigResTy :: DataCon -> Type -- | Instantiate the universal tyvars of a data con, returning ( -- instantiated existentials , instantiated constraints including -- dependent GADT equalities which are *also* listed in the instantiated -- existentials , instantiated args) dataConInstSig :: DataCon -> [Type] -> ([TyCoVar], ThetaType, [Type]) -- | The "signature" of the DataCon returns, in order: -- -- 1) The result of dataConUnivAndExTyCoVars, -- -- 2) All the ThetaTypes relating to the DataCon (coercion, -- dictionary, implicit parameter - whatever), including dependent GADT -- equalities. Dependent GADT equalities are *also* listed in return -- value (1), so be careful! -- -- 3) The type arguments to the constructor -- -- 4) The original result type of the DataCon dataConSig :: DataCon -> ([TyCoVar], ThetaType, [Type], Type) dataConBoxer :: DataCon -> Maybe DataConBoxer dataConImplBangs :: DataCon -> [HsImplBang] -- | Give the demands on the arguments of a Core constructor application -- (Con dc args) dataConRepStrictness :: DataCon -> [StrictnessMark] -- | Return whether there are any argument types for this DataCons -- runtime representation type See Note [DataCon arities] isNullaryRepDataCon :: DataCon -> Bool -- | Return whether there are any argument types for this DataCons -- original source type See Note [DataCon arities] isNullarySrcDataCon :: DataCon -> Bool -- | Gives the number of actual fields in the representation of the -- data constructor. This may be more than appear in the source code; the -- extra ones are the existentially quantified dictionaries dataConRepArity :: DataCon -> Arity -- | Strictness/unpack annotations, from user; or, for imported DataCons, -- from the interface file The list is in one-to-one correspondence with -- the arity of the DataCon dataConSrcBangs :: DataCon -> [HsSrcBang] -- | Extract the label and type for any given labelled field of the -- DataCon, or return Nothing if the field does not belong -- to it dataConFieldType_maybe :: DataCon -> FieldLabelString -> Maybe (FieldLabel, Type) -- | Extract the type for any given labelled field of the DataCon dataConFieldType :: DataCon -> FieldLabelString -> Type -- | Find all the Ids implicitly brought into scope by the data -- constructor. Currently, the union of the dataConWorkId and the -- dataConWrapId dataConImplicitTyThings :: DataCon -> [TyThing] -- | Returns an Id which looks like the Haskell-source constructor by using -- the wrapper if it exists (see dataConWrapId_maybe) and failing -- over to the worker (see dataConWorkId) dataConWrapId :: DataCon -> Id -- | Get the Id of the DataCon wrapper: a function that wraps the -- "actual" constructor so it has the type visible in the source program: -- c.f. dataConWorkId. Returns Nothing if there is no wrapper, -- which occurs for an algebraic data constructor and also for a newtype -- (whose constructor is inlined compulsorily) dataConWrapId_maybe :: DataCon -> Maybe Id -- | Get the Id of the DataCon worker: a function that is the -- "actual" constructor and has no top level binding in the program. The -- type may be different from the obvious one written in the source -- program. Panics if there is no such Id for this DataCon dataConWorkId :: DataCon -> Id -- | The *full* constraints on the constructor type, including dependent -- GADT equalities. dataConTheta :: DataCon -> ThetaType -- | Equalities derived from the result type of the data constructor, as -- written by the programmer in any GADT declaration. This includes *all* -- GADT-like equalities, including those written in by hand by the -- programmer. dataConEqSpec :: DataCon -> [EqSpec] -- | Both the universal and existential type/coercion variables of the -- constructor dataConUnivAndExTyCoVars :: DataCon -> [TyCoVar] -- | The universally-quantified type variables of the constructor dataConUnivTyVars :: DataCon -> [TyVar] -- | Should the DataCon be presented infix? dataConIsInfix :: DataCon -> Bool -- | The representation type of the data constructor, i.e. the sort type -- that will represent values of this type at runtime dataConRepType :: DataCon -> Type -- | The original type constructor used in the definition of this data -- constructor. In case of a data family instance, that will be the -- family type constructor. dataConOrigTyCon :: DataCon -> TyCon dataConTagZ :: DataCon -> ConTagZ -- | The tag used for ordering DataCons dataConTag :: DataCon -> ConTag -- | Build a new data constructor mkDataCon :: Name -> Bool -> TyConRepName -> [HsSrcBang] -> [FieldLabel] -> [TyVar] -> [TyCoVar] -> [TyVarBinder] -> [EqSpec] -> KnotTied ThetaType -> [KnotTied Type] -> KnotTied Type -> RuntimeRepInfo -> KnotTied TyCon -> ConTag -> ThetaType -> Id -> DataConRep -> DataCon isMarkedStrict :: StrictnessMark -> Bool isSrcUnpacked :: SrcUnpackedness -> Bool isSrcStrict :: SrcStrictness -> Bool isBanged :: HsImplBang -> Bool -- | Compare strictness annotations eqHsBang :: HsImplBang -> HsImplBang -> Bool -- | Filter out any TyVars mentioned in an EqSpec. filterEqSpec :: [EqSpec] -> [TyVar] -> [TyVar] -- | Substitute in an EqSpec. Precondition: if the LHS of the EqSpec -- is mapped in the substitution, it is mapped to a type variable, not a -- full type. substEqSpec :: TCvSubst -> EqSpec -> EqSpec eqSpecPreds :: [EqSpec] -> ThetaType eqSpecPair :: EqSpec -> (TyVar, Type) eqSpecType :: EqSpec -> Type eqSpecTyVar :: EqSpec -> TyVar -- | Make a non-dependent EqSpec mkEqSpec :: TyVar -> Type -> EqSpec -- | Haskell Source Bang -- -- Bangs on data constructor arguments as the user wrote them in the -- source code. -- -- (HsSrcBang _ SrcUnpack SrcLazy) and (HsSrcBang _ -- SrcUnpack NoSrcStrict) (without StrictData) makes no sense, we -- emit a warning (in checkValidDataCon) and treat it like (HsSrcBang -- _ NoSrcUnpack SrcLazy) data HsSrcBang HsSrcBang :: SourceText -> SrcUnpackedness -> SrcStrictness -> HsSrcBang -- | Haskell Implementation Bang -- -- Bangs of data constructor arguments as generated by the compiler after -- consulting HsSrcBang, flags, etc. data HsImplBang -- | Lazy field, or one with an unlifted type HsLazy :: HsImplBang -- | Strict but not unpacked field HsStrict :: HsImplBang -- | Strict and unpacked field co :: arg-ty ~ product-ty HsBang HsUnpack :: Maybe Coercion -> HsImplBang -- | Source Strictness -- -- What strictness annotation the user wrote data SrcStrictness -- | Lazy, ie '~' SrcLazy :: SrcStrictness -- | Strict, ie ! SrcStrict :: SrcStrictness -- | no strictness annotation NoSrcStrict :: SrcStrictness -- | Source Unpackedness -- -- What unpackedness the user requested data SrcUnpackedness -- | {--} specified SrcUnpack :: SrcUnpackedness -- | {--} specified SrcNoUnpack :: SrcUnpackedness -- | no unpack pragma NoSrcUnpack :: SrcUnpackedness data StrictnessMark MarkedStrict :: StrictnessMark NotMarkedStrict :: StrictnessMark isEqPrimPred :: PredType -> Bool isEqPred :: PredType -> Bool isClassPred :: PredType -> Bool isEvVarType :: Type -> Bool getClassPredTys_maybe :: PredType -> Maybe (Class, [Type]) instanceCantMatch :: [Maybe Name] -> [Maybe Name] -> Bool roughMatchTcs :: [Type] -> [Maybe Name] -- | hsOverLitNeedsParens p ol returns True if an -- overloaded literal ol needs to be parenthesized under -- precedence p. hsOverLitNeedsParens :: PprPrec -> HsOverLit x -> Bool -- | hsLitNeedsParens p l returns True if a literal -- l needs to be parenthesized under precedence p. hsLitNeedsParens :: PprPrec -> HsLit x -> Bool -- | pmPprHsLit pretty prints literals and is used when pretty printing -- pattern match warnings. All are printed the same (i.e., without hashes -- if they are primitive and not wrapped in constructors if they are -- boxed). This happens mainly for too reasons: * We do not want to -- expose their internal representation * The warnings become too messy pmPprHsLit :: forall (x :: Pass). HsLit (GhcPass x) -> SDoc pp_st_suffix :: SourceText -> SDoc -> SDoc -> SDoc -- | Convert a literal from one index type to another, updating the -- annotations according to the relevant Convertable instance convertLit :: ConvertIdX a b => HsLit a -> HsLit b overLitType :: HsOverLit GhcTc -> Type negateOverLitVal :: OverLitVal -> OverLitVal -- | Haskell Literal data HsLit x -- | Character HsChar :: XHsChar x -> Char -> HsLit x -- | Unboxed character HsCharPrim :: XHsCharPrim x -> Char -> HsLit x -- | String HsString :: XHsString x -> FastString -> HsLit x -- | Packed bytes HsStringPrim :: XHsStringPrim x -> ByteString -> HsLit x -- | Genuinely an Int; arises from TcGenDeriv, and from -- TRANSLATION HsInt :: XHsInt x -> IntegralLit -> HsLit x -- | literal Int# HsIntPrim :: XHsIntPrim x -> Integer -> HsLit x -- | literal Word# HsWordPrim :: XHsWordPrim x -> Integer -> HsLit x -- | literal Int64# HsInt64Prim :: XHsInt64Prim x -> Integer -> HsLit x -- | literal Word64# HsWord64Prim :: XHsWord64Prim x -> Integer -> HsLit x -- | Genuinely an integer; arises only from TRANSLATION (overloaded -- literals are done with HsOverLit) HsInteger :: XHsInteger x -> Integer -> Type -> HsLit x -- | Genuinely a rational; arises only from TRANSLATION (overloaded -- literals are done with HsOverLit) HsRat :: XHsRat x -> FractionalLit -> Type -> HsLit x -- | Unboxed Float HsFloatPrim :: XHsFloatPrim x -> FractionalLit -> HsLit x -- | Unboxed Double HsDoublePrim :: XHsDoublePrim x -> FractionalLit -> HsLit x XLit :: XXLit x -> HsLit x -- | Haskell Overloaded Literal data HsOverLit p OverLit :: XOverLit p -> OverLitVal -> HsExpr p -> HsOverLit p [ol_ext] :: HsOverLit p -> XOverLit p [ol_val] :: HsOverLit p -> OverLitVal [ol_witness] :: HsOverLit p -> HsExpr p XOverLit :: XXOverLit p -> HsOverLit p data OverLitTc OverLitTc :: Bool -> Type -> OverLitTc [ol_rebindable] :: OverLitTc -> Bool [ol_type] :: OverLitTc -> Type -- | Overloaded Literal Value data OverLitVal -- | Integer-looking literals; HsIntegral :: !IntegralLit -> OverLitVal -- | Frac-looking literals HsFractional :: !FractionalLit -> OverLitVal -- | String-looking literals HsIsString :: !SourceText -> !FastString -> OverLitVal pprLiteral :: (SDoc -> SDoc) -> Literal -> SDoc absentLiteralOf :: TyCon -> Maybe Literal -- | Find the Haskell Type the literal occupies literalType :: Literal -> Type litIsLifted :: Literal -> Bool litFitsInChar :: Literal -> Bool -- | True if code space does not go bad if we duplicate this literal litIsDupable :: DynFlags -> Literal -> Bool -- | True if there is absolutely no penalty to duplicating the literal. -- False principally of strings. -- -- "Why?", you say? I'm glad you asked. Well, for one duplicating strings -- would blow up code sizes. Not only this, it's also unsafe. -- -- Consider a program that wants to traverse a string. One way it might -- do this is to first compute the Addr# pointing to the end of the -- string, and then, starting from the beginning, bump a pointer using -- eqAddr# to determine the end. For instance, -- --
--   -- Given pointers to the start and end of a string, count how many zeros
--   -- the string contains.
--   countZeros :: Addr -> -> Int
--   countZeros start end = go start 0
--     where
--       go off n
--         | off `addrEq#` end = n
--         | otherwise         = go (off `plusAddr#` 1) n'
--         where n' | isTrue off 0 0#) = n + 1
--                  | otherwise                                 = n
--   
-- -- Consider what happens if we considered strings to be trivial (and -- therefore duplicable) and emitted a call like countZeros "hello" -- plusAddr# 5). The beginning and end pointers do not -- belong to the same string, meaning that an iteration like the above -- would blow up terribly. This is what happened in #12757. -- -- Ultimately the solution here is to make primitive strings a bit more -- structured, ensuring that the compiler can't inline in ways that will -- break user code. One approach to this is described in #8472. litIsTrivial :: Literal -> Bool -- | A nonsense literal of type forall (a :: TYPE -- UnliftedRep). a. rubbishLit :: Literal nullAddrLit :: Literal double2FloatLit :: Literal -> Literal float2DoubleLit :: Literal -> Literal int2DoubleLit :: Literal -> Literal double2IntLit :: Literal -> Literal int2FloatLit :: Literal -> Literal float2IntLit :: Literal -> Literal int2CharLit :: Literal -> Literal char2IntLit :: Literal -> Literal narrow32WordLit :: Literal -> Literal narrow16WordLit :: Literal -> Literal narrow8WordLit :: Literal -> Literal narrow32IntLit :: Literal -> Literal narrow16IntLit :: Literal -> Literal narrow8IntLit :: Literal -> Literal -- | Narrow a literal number (unchecked result range) narrowLit :: Integral a => Proxy a -> Literal -> Literal int2WordLit :: DynFlags -> Literal -> Literal word2IntLit :: DynFlags -> Literal -> Literal -- | Indicate if the Literal contains an Integer value, e.g. -- Char, Int, Word, LitInteger and -- LitNatural. isLitValue :: Literal -> Bool -- | Apply a function to the Integer contained in the -- Literal, for when that makes sense, e.g. for Char and -- numbers. For fixed-size integral literals, the result will be wrapped -- in accordance with the semantics of the target type. See Note -- [WordInt underflowoverflow] mapLitValue :: DynFlags -> (Integer -> Integer) -> Literal -> Literal -- | Returns the Integer contained in the Literal, for when -- that makes sense, i.e. for Char and numbers. isLitValue_maybe :: Literal -> Maybe Integer -- | Returns the Integer contained in the Literal, for when -- that makes sense, i.e. for Char, Int, Word, -- LitInteger and LitNatural. litValue :: Literal -> Integer -- | Tests whether the literal represents a zero of whatever type it is isZeroLit :: Literal -> Bool inCharRange :: Char -> Bool inWordRange :: DynFlags -> Integer -> Bool inIntRange :: DynFlags -> Integer -> Bool mkLitNatural :: Integer -> Type -> Literal mkLitInteger :: Integer -> Type -> Literal -- | Creates a Literal of type Addr#, which is appropriate -- for passing to e.g. some of the "error" functions in GHC.Err such as -- GHC.Err.runtimeError mkLitString :: String -> Literal -- | Creates a Literal of type Char# mkLitChar :: Char -> Literal -- | Creates a Literal of type Double# mkLitDouble :: Rational -> Literal -- | Creates a Literal of type Float# mkLitFloat :: Rational -> Literal -- | Creates a Literal of type Word64#. If the argument is -- out of the range, it is wrapped. mkLitWord64Wrap :: DynFlags -> Integer -> Literal -- | Creates a Literal of type Word64# mkLitWord64 :: Integer -> Literal -- | Creates a Literal of type Int64#. If the argument is -- out of the range, it is wrapped. mkLitInt64Wrap :: DynFlags -> Integer -> Literal -- | Creates a Literal of type Int64# mkLitInt64 :: Integer -> Literal -- | Creates a Literal of type Word#, as well as a -- Boolean flag indicating carry. That is, if the argument is out -- of the (target-dependent) range the argument is wrapped and the carry -- flag will be set. See Note [WordInt underflowoverflow] mkLitWordWrapC :: DynFlags -> Integer -> (Literal, Bool) -- | Creates a Literal of type Word#. If the argument is -- out of the (target-dependent) range, it is wrapped. See Note -- [WordInt underflowoverflow] mkLitWordWrap :: DynFlags -> Integer -> Literal -- | Creates a Literal of type Word# mkLitWord :: DynFlags -> Integer -> Literal -- | Creates a Literal of type Int#, as well as a -- Boolean flag indicating overflow. That is, if the argument is -- out of the (target-dependent) range the argument is wrapped and the -- overflow flag will be set. See Note [WordInt underflowoverflow] mkLitIntWrapC :: DynFlags -> Integer -> (Literal, Bool) -- | Creates a Literal of type Int#. If the argument is out -- of the (target-dependent) range, it is wrapped. See Note [WordInt -- underflowoverflow] mkLitIntWrap :: DynFlags -> Integer -> Literal -- | Creates a Literal of type Int# mkLitInt :: DynFlags -> Integer -> Literal -- | Create a numeric Literal of the given type mkLitNumber :: DynFlags -> LitNumType -> Integer -> Type -> Literal -- | Check that a given number is in the range of a numeric literal litNumCheckRange :: DynFlags -> LitNumType -> Integer -> Bool -- | Create a numeric Literal of the given type mkLitNumberWrap :: DynFlags -> LitNumType -> Integer -> Type -> Literal -- | Indicate if a numeric literal type supports negative numbers litNumIsSigned :: LitNumType -> Bool -- | So-called Literals are one of: -- -- -- -- We maintain the invariant that the Integer in the -- LitNumber constructor is actually in the (possibly -- target-dependent) range. The mkLit{Int,Word}*Wrap smart constructors -- ensure this by applying the target machine's wrapping semantics. Use -- these in situations where you know the wrapping semantics are correct. -- -- data Literal -- | Char# - at least 31 bits. Create with mkLitChar LitChar :: Char -> Literal -- | Any numeric literal that can be internally represented with an -- Integer. See Note [Types of LitNumbers] below for the Type field. LitNumber :: !LitNumType -> !Integer -> Type -> Literal -- | A string-literal: stored and emitted UTF-8 encoded, we'll arrange to -- decode it at runtime. Also emitted with a '\0' terminator. -- Create with mkLitString LitString :: ByteString -> Literal -- | The NULL pointer, the only pointer value that can be -- represented as a Literal. Create with nullAddrLit LitNullAddr :: Literal -- | A nonsense value, used when an unlifted binding is absent and has type -- forall (a :: TYPE UnliftedRep). a. May be -- lowered by code-gen to any possible value. Also see Note [Rubbish -- literals] LitRubbish :: Literal -- | Float#. Create with mkLitFloat LitFloat :: Rational -> Literal -- | Double#. Create with mkLitDouble LitDouble :: Rational -> Literal -- | A label literal. Parameters: -- -- 1) The name of the symbol mentioned in the declaration -- -- 2) The size (in bytes) of the arguments the label expects. Only -- applicable with stdcall labels. Just x => -- <x> will be appended to label name when emitting -- assembly. -- -- 3) Flag indicating whether the symbol references a function or a data LitLabel :: FastString -> Maybe Int -> FunctionOrData -> Literal -- | Numeric literal type data LitNumType -- | Integer (see Note [Integer literals]) LitNumInteger :: LitNumType -- | Natural (see Note [Natural literals]) LitNumNatural :: LitNumType -- | Int# - according to target machine LitNumInt :: LitNumType -- | Int64# - exactly 64 bits LitNumInt64 :: LitNumType -- | Word# - according to target machine LitNumWord :: LitNumType -- | Word64# - exactly 64 bits LitNumWord64 :: LitNumType -- | Does a TyCon (that is applied to some number of arguments) need -- to be ascribed with an explicit kind signature to resolve ambiguity if -- rendered as a source-syntax type? (See Note [When does a tycon -- application need an explicit kind signature?] for a full -- explanation of what this function checks for.) tyConAppNeedsKindSig :: Bool -> TyCon -> Int -> Bool -- | Does this classify a type allowed to have values? Responds True to -- things like *, #, TYPE Lifted, TYPE v, Constraint. -- -- True of any sub-kind of OpenTypeKind classifiesTypeWithValues :: Kind -> Bool -- | Tests whether the given kind (which should look like TYPE x) -- is something other than a constructor tree (that is, constructors at -- every node). E.g. True of TYPE k, TYPE (F Int) False of TYPE -- 'LiftedRep isKindLevPoly :: Kind -> Bool isConstraintKindCon :: TyCon -> Bool setJoinResTy :: Int -> Type -> Type -> Type modifyJoinResTy :: Int -> (Type -> Type) -> Type -> Type splitVisVarsOfTypes :: [Type] -> Pair TyCoVarSet -- | Retrieve the free variables in this type, splitting them based on -- whether they are used visibly or invisibly. Invisible ones come first. splitVisVarsOfType :: Type -> Pair TyCoVarSet -- | Find the result Kind of a type synonym, after applying it to -- its arity number of type variables Actually this function -- works fine on data types too, but they'd always return *, so we -- never need to ask synTyConResKind :: TyCon -> Kind -- | All type constructors occurring in the type; looking through type -- synonyms, but not newtypes. When it finds a Class, it returns the -- class TyCon. tyConsOfType :: Type -> UniqSet TyCon occCheckExpand :: [Var] -> Type -> Maybe Type -- | Looking past all pi-types, is the end result potentially levity -- polymorphic? Example: True for (forall r (a :: TYPE r). String -> -- a) Example: False for (forall r1 r2 (a :: TYPE r1) (b :: TYPE r2). a -- -> b -> Type) resultIsLevPoly :: Type -> Bool -- | Returns True if a type is levity polymorphic. Should be the same as -- (isKindLevPoly . typeKind) but much faster. Precondition: The type has -- kind (TYPE blah) isTypeLevPoly :: Type -> Bool tcReturnsConstraintKind :: Kind -> Bool -- | Is this kind equivalent to TYPE r (for some unknown r)? -- -- This considers Constraint to be distinct from *. tcIsRuntimeTypeKind :: Kind -> Bool -- | Is this kind equivalent to *? -- -- This considers Constraint to be distinct from *. For -- a version that treats them as the same type, see -- isLiftedTypeKind. tcIsLiftedTypeKind :: Kind -> Bool tcIsConstraintKind :: Kind -> Bool tcTypeKind :: HasDebugCallStack => Type -> Kind -- | Compare two TyCons. NB: This should never see -- Constraint (as recognized by Kind.isConstraintKindCon) which -- is considered a synonym for Type in Core. See Note [Kind -- Constraint and kind Type] in Kind. See Note [nonDetCmpType -- nondeterminism] nonDetCmpTc :: TyCon -> TyCon -> Ordering nonDetCmpTypesX :: RnEnv2 -> [Type] -> [Type] -> Ordering nonDetCmpTypeX :: RnEnv2 -> Type -> Type -> Ordering nonDetCmpTypes :: [Type] -> [Type] -> Ordering nonDetCmpType :: Type -> Type -> Ordering eqVarBndrs :: RnEnv2 -> [Var] -> [Var] -> Maybe RnEnv2 -- | Type equality on lists of types, looking through type synonyms but not -- newtypes. eqTypes :: [Type] -> [Type] -> Bool -- | Compare types with respect to a (presumably) non-empty RnEnv2. eqTypeX :: RnEnv2 -> Type -> Type -> Bool seqTypes :: [Type] -> () seqType :: Type -> () -- | Determine whether a type could be the type of a join point of given -- total arity, according to the polymorphism rule. A join point cannot -- be polymorphic in its return type, since given join j a b x y -- z = e1 in e2, the types of e1 and e2 must be the same, and a and b are -- not in scope for e2. (See Note [The polymorphism rule of join points] -- in CoreSyn.) Returns False also if the type simply doesn't have enough -- arguments. -- -- Note that we need to know how many arguments (type *and* value) the -- putative join point takes; for instance, if j :: forall a. a -> Int -- then j could be a binary join point returning an Int, but it could -- *not* be a unary join point returning a -> Int. -- -- TODO: See Note [Excess polymorphism and join points] isValidJoinPointType :: JoinArity -> Type -> Bool -- | Returns true of types that are opaque to Haskell. isPrimitiveType :: Type -> Bool -- | Computes whether an argument (or let right hand side) should be -- computed strictly or lazily, based only on its type. Currently, it's -- just isUnliftedType. Panics on levity-polymorphic types. isStrictType :: HasDebugCallStack => Type -> Bool -- | Check whether a type is a data family type isDataFamilyAppType :: Type -> Bool -- | See Type#type_classification for what an algebraic type is. -- Should only be applied to types, as opposed to e.g. partially -- saturated type constructors isAlgType :: Type -> Bool isUnboxedSumType :: Type -> Bool isUnboxedTupleType :: Type -> Bool -- | Extract the RuntimeRep classifier of a type. For instance, -- getRuntimeRep_maybe Int = LiftedRep. Panics if this is not -- possible. getRuntimeRep :: HasDebugCallStack => Type -> Type -- | Extract the RuntimeRep classifier of a type. For instance, -- getRuntimeRep_maybe Int = LiftedRep. Returns Nothing -- if this is not possible. getRuntimeRep_maybe :: HasDebugCallStack => Type -> Maybe Type -- | Drops prefix of RuntimeRep constructors in TyConApps. Useful -- for e.g. dropping 'LiftedRep arguments of unboxed tuple TyCon -- applications: -- -- dropRuntimeRepArgs [ 'LiftedRep, 'IntRep , String, Int] dropRuntimeRepArgs :: [Type] -> [Type] -- | Is this a type of kind RuntimeRep? (e.g. LiftedRep) isRuntimeRepKindedTy :: Type -> Bool -- | Returns: -- -- mightBeUnliftedType :: Type -> Bool -- | See Type#type_classification for what an unlifted type is. -- Panics on levity polymorphic types; See mightBeUnliftedType for -- a more approximate predicate that behaves better in the presence of -- levity polymorphism. isUnliftedType :: HasDebugCallStack => Type -> Bool -- | Returns Just True if this type is surely lifted, Just False if it is -- surely unlifted, Nothing if we can't be sure (i.e., it is levity -- polymorphic), and panics if the kind does not have the shape TYPE r. isLiftedType_maybe :: HasDebugCallStack => Type -> Maybe Bool -- | Does this type classify a core (unlifted) Coercion? At either role -- nominal or representational (t1 ~ t2) See Note [Types for coercions, -- predicates, and evidence] in TyCoRep isCoVarType :: Type -> Bool isFamFreeTy :: Type -> Bool -- | Get the type on the LHS of a coercion induced by a type/data family -- instance. coAxNthLHS :: forall (br :: BranchFlag). CoAxiom br -> Int -> Type -- | Given a family instance TyCon and its arg types, return the -- corresponding family type. E.g: -- --
--   data family T a
--   data instance T (Maybe b) = MkT b
--   
-- -- Where the instance tycon is :RTL, so: -- --
--   mkFamilyTyConApp :RTL Int  =  T (Maybe Int)
--   
mkFamilyTyConApp :: TyCon -> [Type] -> Type -- | Add the kind variables free in the kinds of the tyvars in the given -- set. Returns a deterministic set. closeOverKindsDSet :: DTyVarSet -> DTyVarSet -- | Add the kind variables free in the kinds of the tyvars in the given -- set. Returns a deterministically ordered list. closeOverKindsList :: [TyVar] -> [TyVar] -- | Given a list of tyvars returns a deterministic FV computation that -- returns the given tyvars with the kind variables free in the kinds of -- the given tyvars. closeOverKindsFV :: [TyVar] -> FV -- | Add the kind variables free in the kinds of the tyvars in the given -- set. Returns a non-deterministic set. closeOverKinds :: TyVarSet -> TyVarSet -- | Extract a relevant type, if there is one. binderRelevantType_maybe :: TyCoBinder -> Maybe Type tyBinderType :: TyBinder -> Type tyCoBinderType :: TyCoBinder -> Type tyCoBinderVar_maybe :: TyCoBinder -> Maybe TyCoVar -- | Does this binder bind a variable that is not erased? Returns -- True for anonymous binders. isAnonTyCoBinder :: TyCoBinder -> Bool -- | Make an anonymous binder mkAnonBinder :: AnonArgFlag -> Type -> TyCoBinder isTauTy :: Type -> Bool -- | Given a Type and a list of argument types to which the -- Type is applied, determine each argument's visibility -- (Inferred, Specified, or Required). -- -- Most of the time, the arguments will be Required, but not -- always. Consider f :: forall a. a -> Type. In f Type -- Bool, the first argument (Type) is Specified and -- the second argument (Bool) is Required. It is -- precisely this sort of higher-rank situation in which -- appTyArgFlags comes in handy, since f Type Bool would -- be represented in Core using AppTys. (See also #15792). appTyArgFlags :: Type -> [Type] -> [ArgFlag] -- | Given a TyCon and a list of argument types to which the -- TyCon is applied, determine each argument's visibility -- (Inferred, Specified, or Required). -- -- Wrinkle: consider the following scenario: -- --
--   T :: forall k. k -> k
--   tyConArgFlags T [forall m. m -> m -> m, S, R, Q]
--   
-- -- After substituting, we get -- --
--   T (forall m. m -> m -> m) :: (forall m. m -> m -> m) -> forall n. n -> n -> n
--   
-- -- Thus, the first argument is invisible, S is visible, -- R is invisible again, and Q is visible. tyConArgFlags :: TyCon -> [Type] -> [ArgFlag] -- | Given a list of things paired with their visibilities, partition the -- things into (invisible things, visible things). partitionInvisibles :: [(a, ArgFlag)] -> ([a], [a]) -- | Given a TyCon and a list of argument types, filter out any -- Inferred arguments. filterOutInferredTypes :: TyCon -> [Type] -> [Type] -- | Given a TyCon and a list of argument types, filter out any -- invisible (i.e., Inferred or Specified) arguments. filterOutInvisibleTypes :: TyCon -> [Type] -> [Type] splitPiTysInvisibleN :: Int -> Type -> ([TyCoBinder], Type) splitPiTysInvisible :: Type -> ([TyCoBinder], Type) invisibleTyBndrCount :: Type -> Int -- | Like splitPiTys but split off only named binders and -- returns TyCoVarBinders rather than TyCoBinders splitForAllVarBndrs :: Type -> ([TyCoVarBinder], Type) -- | Split off all TyCoBinders to a type, splitting both proper foralls and -- functions splitPiTys :: Type -> ([TyCoBinder], Type) -- | Takes a forall type apart, or panics splitPiTy :: Type -> (TyCoBinder, Type) -- | Attempts to take a forall type apart; works with proper foralls and -- functions splitPiTy_maybe :: Type -> Maybe (TyCoBinder, Type) -- | Like splitForAllTy_maybe, but only returns Just if it is a covar -- binder. splitForAllTy_co_maybe :: Type -> Maybe (TyCoVar, Type) -- | Like splitForAllTy_maybe, but only returns Just if it is a tyvar -- binder. splitForAllTy_ty_maybe :: Type -> Maybe (TyCoVar, Type) -- | Attempts to take a forall type apart, but only if it's a proper -- forall, with a named binder splitForAllTy_maybe :: Type -> Maybe (TyCoVar, Type) -- | Drops all ForAllTys dropForAlls :: Type -> Type -- | Take a forall type apart, or panics if that is not possible. splitForAllTy :: Type -> (TyCoVar, Type) -- | Is this a function? isFunTy :: Type -> Bool -- | Is this a function or forall? isPiTy :: Type -> Bool -- | Like isForAllTy, but returns True only if it is a covar binder isForAllTy_co :: Type -> Bool -- | Like isForAllTy, but returns True only if it is a tyvar binder isForAllTy_ty :: Type -> Bool -- | Checks whether this is a proper forall (with a named binder) isForAllTy :: Type -> Bool -- | Like splitForAllTys, but only splits a ForAllTy if -- sameVis argf supplied_argf is True, where -- argf is the visibility of the ForAllTy's binder and -- supplied_argf is the visibility provided as an argument to -- this function. splitForAllTysSameVis :: ArgFlag -> Type -> ([TyCoVar], Type) -- | Take a ForAllTy apart, returning the list of tycovars and the result -- type. This always succeeds, even if it returns only an empty list. -- Note that the result type returned may have free variables that were -- bound by a forall. splitForAllTys :: Type -> ([TyCoVar], Type) -- | Given a list of type-level vars and the free vars of a result kind, -- makes TyCoBinders, preferring anonymous binders if the variable is, in -- fact, not dependent. e.g. mkTyConBindersPreferAnon -- (k:*),(b:k),(c:k) We want (k:*) Named, (b:k) Anon, (c:k) Anon -- -- All non-coercion binders are visible. mkTyConBindersPreferAnon :: [TyVar] -> TyCoVarSet -> [TyConBinder] -- | mkLamType for multiple type or value arguments mkLamTypes :: [Var] -> Type -> Type -- | Makes a (->) type or an implicit forall type, depending on -- whether it is given a type variable or a term variable. This is used, -- for example, when producing the type of a lambda. Always uses Inferred -- binders. mkLamType :: Var -> Type -> Type -- | Like mkForAllTys, but assumes all variables are dependent and visible mkVisForAllTys :: [TyVar] -> Type -> Type -- | Like mkForAllTys, but assumes all variables are dependent and -- Specified, a common case mkSpecForAllTys :: [TyVar] -> Type -> Type -- | Like mkForAllTy, but assumes the variable is dependent and -- Specified, a common case mkSpecForAllTy :: TyVar -> Type -> Type -- | Like mkTyCoInvForAllTys, but tvs should be a list of tyvar mkInvForAllTys :: [TyVar] -> Type -> Type -- | Like mkForAllTys, but assumes all variables are dependent and -- Inferred, a common case mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type -- | Like mkTyCoInvForAllTy, but tv should be a tyvar mkInvForAllTy :: TyVar -> Type -> Type -- | Make a dependent forall over an Inferred variable mkTyCoInvForAllTy :: TyCoVar -> Type -> Type stripCoercionTy :: Type -> Coercion isCoercionTy_maybe :: Type -> Maybe Coercion mkCoercionTy :: Coercion -> Type -- | Drop the cast on a type, if any. If there is no cast, just return the -- original type. This is rarely what you want. The CastTy data -- constructor (in TyCoRep) has the invariant that another CastTy is not -- inside. See the data constructor for a full description of this -- invariant. Since CastTy cannot be nested, the result of discardCast -- cannot be a CastTy. discardCast :: Type -> Type tyConBindersTyCoBinders :: [TyConBinder] -> [TyCoBinder] splitCastTy_maybe :: Type -> Maybe (Type, Coercion) -- | Unwrap one layer of newtype on a type constructor and its -- arguments, using an eta-reduced version of the newtype if -- possible. This requires tys to have at least newTyConInstArity -- tycon elements. newTyConInstRhs :: TyCon -> [Type] -> Type nextRole :: Type -> Role -- | Attempts to tease a list type apart and gives the type of the elements -- if successful (looks through type synonyms) splitListTyConApp_maybe :: Type -> Maybe Type -- | Like splitTyConApp_maybe, but doesn't look through synonyms. -- This assumes the synonyms have already been dealt with. -- -- Moreover, for a FunTy, it only succeeds if the argument types have -- enough info to extract the runtime-rep arguments that the funTyCon -- requires. This will usually be true; but may be temporarily false -- during canonicalization: see Note [FunTy and decomposing tycon -- applications] in TcCanonical repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) -- | Split a type constructor application into its type constructor and -- applied types. Note that this may fail in the case of a FunTy -- with an argument of unknown kind FunTy (e.g. FunTy (a :: k) -- Int. since the kind of a isn't of the form TYPE -- rep). Consequently, you may need to zonk your type before using -- this function. -- -- If you only need the TyCon, consider using -- tcTyConAppTyCon_maybe. tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type]) -- | Attempts to tease a type apart into a type constructor and the -- application of a number of arguments to that constructor. Panics if -- that is not possible. See also splitTyConApp_maybe splitTyConApp :: Type -> (TyCon, [Type]) tyConAppArgN :: Int -> Type -> Type tyConAppArgs :: Type -> [Type] -- | The same as snd . splitTyConApp tyConAppArgs_maybe :: Type -> Maybe [Type] tyConAppTyCon :: Type -> TyCon -- | The same as fst . splitTyConApp tyConAppTyCon_maybe :: Type -> Maybe TyCon -- | Retrieve the tycon heading this type, if there is one. Does not -- look through synonyms. tyConAppTyConPicky_maybe :: Type -> Maybe TyCon -- | A key function: builds a TyConApp or FunTy as -- appropriate to its arguments. Applies its arguments to the constructor -- from left to right. mkTyConApp :: TyCon -> [Type] -> Type applyTysX :: [TyVar] -> Type -> [Type] -> Type -- | (piResultTys f_ty [ty1, .., tyn]) gives the type of (f ty1 .. tyn) -- where f :: f_ty piResultTys is interesting because: 1. -- f_ty may have more for-alls than there are args 2. Less -- obviously, it may have fewer for-alls For case 2. think of: -- piResultTys (forall a.a) [forall b.b, Int] This really can happen, but -- only (I think) in situations involving undefined. For example: -- undefined :: forall a. a Term: undefined (forall b. b->b) -- Int This term should have type (Int -> Int), but notice that -- there are more type args than foralls in undefineds type. piResultTys :: HasDebugCallStack => Type -> [Type] -> Type -- | Just like piResultTys but for a single argument Try not to -- iterate piResultTy, because it's inefficient to substitute one -- variable at a time; instead use 'piResultTys" -- -- Extract the function argument type and panic if that is not possible funArgTy :: Type -> Type -- | Extract the function result type and panic if that is not possible funResultTy :: Type -> Type splitFunTys :: Type -> ([Type], Type) -- | Attempts to extract the argument and result types from a type splitFunTy_maybe :: Type -> Maybe (Type, Type) -- | Attempts to extract the argument and result types from a type, and -- panics if that is not possible. See also splitFunTy_maybe splitFunTy :: Type -> (Type, Type) -- | Render a type corresponding to a user type error into a SDoc. pprUserTypeErrorTy :: Type -> SDoc -- | Is this type a custom user error? If so, give us the kind and the -- error message. userTypeError_maybe :: Type -> Maybe Type -- | Is this a type literal (symbol or numeric). isLitTy :: Type -> Maybe TyLit -- | Is this a symbol literal. We also look through type synonyms. isStrLitTy :: Type -> Maybe FastString mkStrLitTy :: FastString -> Type -- | Is this a numeric literal. We also look through type synonyms. isNumLitTy :: Type -> Maybe Integer mkNumLitTy :: Integer -> Type -- | Like splitAppTys, but doesn't look through type synonyms repSplitAppTys :: HasDebugCallStack => Type -> (Type, [Type]) -- | Recursively splits a type as far as is possible, leaving a residual -- type being applied to and the type arguments applied to it. Never -- fails, even if that means returning an empty list of type -- applications. splitAppTys :: Type -> (Type, [Type]) -- | Attempts to take a type application apart, as in -- splitAppTy_maybe, and panics if this is not possible splitAppTy :: Type -> (Type, Type) -- | Does the AppTy split as in tcSplitAppTy_maybe, but assumes -- that any coreView stuff is already done. Refuses to look through (c -- => t) tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type) -- | Does the AppTy split as in splitAppTy_maybe, but assumes that -- any Core view stuff is already done repSplitAppTy_maybe :: HasDebugCallStack => Type -> Maybe (Type, Type) -- | Attempt to take a type application apart, whether it is a function, -- type constructor, or plain type application. Note that type family -- applications are NEVER unsaturated by this! splitAppTy_maybe :: Type -> Maybe (Type, Type) mkAppTys :: Type -> [Type] -> Type -- | Attempts to obtain the type variable underlying a Type, without -- any expansion repGetTyVar_maybe :: Type -> Maybe TyVar -- | If the type is a tyvar, possibly under a cast, returns it, along with -- the coercion. Thus, the co is :: kind tv ~N kind ty getCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN) -- | Attempts to obtain the type variable underlying a Type getTyVar_maybe :: Type -> Maybe TyVar isTyVarTy :: Type -> Bool -- | Attempts to obtain the type variable underlying a Type, and -- panics with the given message if this is not a type variable type. See -- also getTyVar_maybe getTyVar :: String -> Type -> TyVar mapCoercion :: Monad m => TyCoMapper env m -> env -> Coercion -> m Coercion mapType :: Monad m => TyCoMapper env m -> env -> Type -> m Type -- | Is a tyvar of type RuntimeRep? isRuntimeRepVar :: TyVar -> Bool isUnliftedRuntimeRep :: Type -> Bool -- | Returns True if the kind classifies unlifted types and False -- otherwise. Note that this returns False for levity-polymorphic kinds, -- which may be specialized to a kind that classifies unlifted types. isUnliftedTypeKind :: Kind -> Bool isLiftedRuntimeRep :: Type -> Bool -- | Given a kind (TYPE rr), extract its RuntimeRep classifier rr. For -- example, kindRep_maybe * = Just LiftedRep Returns -- Nothing if the kind is not of form (TYPE rr) Treats * and -- Constraint as the same kindRep_maybe :: HasDebugCallStack => Kind -> Maybe Type -- | Extract the RuntimeRep classifier of a type from its kind. For -- example, kindRep * = LiftedRep; Panics if this is not -- possible. Treats * and Constraint as the same kindRep :: HasDebugCallStack => Kind -> Type -- | Expand out all type synonyms. Actually, it'd suffice to expand out -- just the ones that discard type variables (e.g. type Funny a = Int) -- But we don't know which those are currently, so we just expand all. -- -- expandTypeSynonyms only expands out type synonyms mentioned in -- the type, not in the kinds of any TyCon or TyVar mentioned in the -- type. -- -- Keep this synchronized with synonymTyConsOfType expandTypeSynonyms :: Type -> Type -- | This describes how a "map" operation over a type/coercion should -- behave data TyCoMapper env (m :: Type -> Type) TyCoMapper :: (env -> TyVar -> m Type) -> (env -> CoVar -> m Coercion) -> (env -> CoercionHole -> m Coercion) -> (env -> TyCoVar -> ArgFlag -> m (env, TyCoVar)) -> (TyCon -> m TyCon) -> TyCoMapper env (m :: Type -> Type) [tcm_tyvar] :: TyCoMapper env (m :: Type -> Type) -> env -> TyVar -> m Type [tcm_covar] :: TyCoMapper env (m :: Type -> Type) -> env -> CoVar -> m Coercion -- | What to do with coercion holes. See Note [Coercion holes] in TyCoRep. [tcm_hole] :: TyCoMapper env (m :: Type -> Type) -> env -> CoercionHole -> m Coercion -- | The returned env is used in the extended scope [tcm_tycobinder] :: TyCoMapper env (m :: Type -> Type) -> env -> TyCoVar -> ArgFlag -> m (env, TyCoVar) -- | This is used only for TcTyCons a) To zonk TcTyCons b) To turn TcTyCons -- into TyCons. See Note [Type checking recursive type and class -- declarations] in TcTyClsDecls [tcm_tycon] :: TyCoMapper env (m :: Type -> Type) -> TyCon -> m TyCon cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar]) cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar) substVarBndrs :: HasCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar]) substVarBndr :: HasCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar) substTyVarBndrs :: HasCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar]) substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar) -- | Substitute within a Coercion disabling sanity checks. The -- problems that the sanity checks in substCo catch are described in Note -- [The substitution invariant]. The goal of #11371 is to migrate all the -- calls of substCoUnchecked to substCo and remove this function. Please -- don't use in new code. substCoUnchecked :: TCvSubst -> Coercion -> Coercion lookupTyVar :: TCvSubst -> TyVar -> Maybe Type substTyVars :: TCvSubst -> [TyVar] -> [Type] substTyVar :: TCvSubst -> TyVar -> Type -- | Substitute within a ThetaType disabling the sanity checks. The -- problems that the sanity checks in substTys catch are described in -- Note [The substitution invariant]. The goal of #11371 is to migrate -- all the calls of substThetaUnchecked to substTheta and remove this -- function. Please don't use in new code. substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType -- | Substitute within a ThetaType The substitution has to satisfy -- the invariants described in Note [The substitution invariant]. substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType -- | Substitute within several Types disabling the sanity checks. -- The problems that the sanity checks in substTys catch are described in -- Note [The substitution invariant]. The goal of #11371 is to migrate -- all the calls of substTysUnchecked to substTys and remove this -- function. Please don't use in new code. substTysUnchecked :: TCvSubst -> [Type] -> [Type] -- | Substitute within several Types The substitution has to satisfy -- the invariants described in Note [The substitution invariant]. substTys :: HasCallStack => TCvSubst -> [Type] -> [Type] -- | Substitute within a Type disabling the sanity checks. The -- problems that the sanity checks in substTy catch are described in Note -- [The substitution invariant]. The goal of #11371 is to migrate all the -- calls of substTyUnchecked to substTy and remove this function. Please -- don't use in new code. substTyUnchecked :: TCvSubst -> Type -> Type -- | Substitute within a Type The substitution has to satisfy the -- invariants described in Note [The substitution invariant]. substTy :: HasCallStack => TCvSubst -> Type -> Type -- | Substitute within a Type after adding the free variables of the -- type to the in-scope set. This is useful for the case when the free -- variables aren't already in the in-scope set or easily available. See -- also Note [The substitution invariant]. substTyAddInScope :: TCvSubst -> Type -> Type -- | Type substitution, see zipTvSubst substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type] -- | Coercion substitution, see zipTvSubst. Disables sanity checks. -- The problems that the sanity checks in substCo catch are described in -- Note [The substitution invariant]. The goal of #11371 is to migrate -- all the calls of substCoUnchecked to substCo and remove this function. -- Please don't use in new code. substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion -- | Type substitution, see zipTvSubst. Disables sanity checks. The -- problems that the sanity checks in substTy catch are described in Note -- [The substitution invariant]. The goal of #11371 is to migrate all the -- calls of substTyUnchecked to substTy and remove this function. Please -- don't use in new code. substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type -- | Type substitution, see zipTvSubst substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv -- | Generates the in-scope set for the TCvSubst from the types in -- the incoming environment. No CoVars, please! mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst -- | Generates the in-scope set for the TCvSubst from the types in -- the incoming environment. No CoVars, please! zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst extendTvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> TCvSubst extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst extendTCvInScope :: TCvSubst -> Var -> TCvSubst zapTCvSubst :: TCvSubst -> TCvSubst setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst notElemTCvSubst :: Var -> TCvSubst -> Bool isInScope :: Var -> TCvSubst -> Bool -- | Returns the free variables of the types in the range of a substitution -- as a non-deterministic set. getTCvSubstRangeFVs :: TCvSubst -> VarSet getTCvInScope :: TCvSubst -> InScopeSet getTvSubstEnv :: TCvSubst -> TvSubstEnv mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst isEmptyTCvSubst :: TCvSubst -> Bool mkEmptyTCvSubst :: InScopeSet -> TCvSubst emptyTCvSubst :: TCvSubst -- | Composes two substitutions, applying the second one provided first, -- like in function composition. composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst -- | (compose env1 env2)(x) is env1(env2(x)); i.e. apply -- env2 then env1. It assumes that both are idempotent. -- Typically, env1 is the refinement to a base substitution -- env2 composeTCvSubstEnv :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) emptyTvSubstEnv :: TvSubstEnv -- | Type & coercion substitution -- -- The following invariants must hold of a TCvSubst: -- --
    --
  1. The in-scope set is needed only to guide the generation of -- fresh uniques
  2. --
  3. In particular, the kind of the type variables in the -- in-scope set is not relevant
  4. --
  5. The substitution is only applied ONCE! This is because in general -- such application will not reach a fixed point.
  6. --
data TCvSubst TCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> TCvSubst -- | A substitution of Types for TyVars and Kinds for -- KindVars type TvSubstEnv = TyVarEnv Type pprTypeApp :: TyCon -> [Type] -> SDoc pprForAll :: [TyCoVarBinder] -> SDoc pprThetaArrowTy :: ThetaType -> SDoc pprParendType :: Type -> SDoc tidyKind :: TidyEnv -> Kind -> Kind tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind) -- | Calls tidyType on a top-level type (i.e. with an empty tidying -- environment) tidyTopType :: Type -> Type tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type) -- | Grabs the free type variables, tidies them and then uses -- tidyType to work over the type itself tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type]) tidyType :: TidyEnv -> Type -> Type tidyTypes :: TidyEnv -> [Type] -> [Type] tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar -- | Treat a new TyCoVar as a binder, and give it a fresh tidy name -- using the environment if one has not already been allocated. See also -- tidyVarBndr tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar) tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar]) -- | Add the free TyVars to the env in tidy form, so that we can -- tidy the type they are free in tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv tidyTyCoVarBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis]) tidyTyCoVarBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis) tidyVarBndr :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar) -- | This tidies up a type for printing in an error message, or in an -- interface file. -- -- It doesn't change the uniques at all, just the print names. tidyVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar]) -- | Get the free vars of types in scoped order tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar] -- | Get the free vars of a type in scoped order tyCoVarsOfTypeWellScoped :: Type -> [TyVar] -- | Do a topological sort on a list of tyvars, so that binders occur -- before occurrences E.g. given [ a::k, k::*, b::k ] it'll return a -- well-scoped list [ k::*, a::k, b::k ] -- -- This is a deterministic sorting operation (that is, doesn't depend on -- Uniques). -- -- It is also meant to be stable: that is, variables should not be -- reordered unnecessarily. This is specified in Note [ScopedSort] See -- also Note [Ordering of implicit variables] in RnTypes scopedSort :: [TyCoVar] -> [TyCoVar] -- | Returns True if this type has no free variables. Should be the same as -- isEmptyVarSet . tyCoVarsOfType, but faster in the non-forall case. noFreeVarsOfType :: Type -> Bool coVarsOfTypes :: [Type] -> TyCoVarSet coVarsOfType :: Type -> CoVarSet tyCoFVsVarBndr :: Var -> FV -> FV tyCoFVsVarBndrs :: [Var] -> FV -> FV tyCoFVsBndr :: TyCoVarBinder -> FV -> FV -- | The worker for tyCoFVsOfType and tyCoFVsOfTypeList. -- The previous implementation used unionVarSet which is O(n+m) -- and can make the function quadratic. It's exported, so that it can be -- composed with other functions that compute free variables. See Note -- [FV naming conventions] in FV. -- -- Eta-expanded because that makes it run faster (apparently) See Note -- [FV eta expansion] in FV for explanation. tyCoFVsOfType :: Type -> FV -- | tyCoFVsOfType that returns free variables of a type in a -- deterministic set. For explanation of why using VarSet is not -- deterministic see Note [Deterministic FV] in FV. tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet tyCoVarsOfTypes :: [Type] -> TyCoVarSet tyCoVarsOfType :: Type -> TyCoVarSet doubleX8PrimTyCon :: TyCon doubleX8PrimTy :: Type floatX16PrimTyCon :: TyCon floatX16PrimTy :: Type doubleX4PrimTyCon :: TyCon doubleX4PrimTy :: Type floatX8PrimTyCon :: TyCon floatX8PrimTy :: Type doubleX2PrimTyCon :: TyCon doubleX2PrimTy :: Type floatX4PrimTyCon :: TyCon floatX4PrimTy :: Type word64X8PrimTyCon :: TyCon word64X8PrimTy :: Type word32X16PrimTyCon :: TyCon word32X16PrimTy :: Type word16X32PrimTyCon :: TyCon word16X32PrimTy :: Type word8X64PrimTyCon :: TyCon word8X64PrimTy :: Type word64X4PrimTyCon :: TyCon word64X4PrimTy :: Type word32X8PrimTyCon :: TyCon word32X8PrimTy :: Type word16X16PrimTyCon :: TyCon word16X16PrimTy :: Type word8X32PrimTyCon :: TyCon word8X32PrimTy :: Type word64X2PrimTyCon :: TyCon word64X2PrimTy :: Type word32X4PrimTyCon :: TyCon word32X4PrimTy :: Type word16X8PrimTyCon :: TyCon word16X8PrimTy :: Type word8X16PrimTyCon :: TyCon word8X16PrimTy :: Type int64X8PrimTyCon :: TyCon int64X8PrimTy :: Type int32X16PrimTyCon :: TyCon int32X16PrimTy :: Type int16X32PrimTyCon :: TyCon int16X32PrimTy :: Type int8X64PrimTyCon :: TyCon int8X64PrimTy :: Type int64X4PrimTyCon :: TyCon int64X4PrimTy :: Type int32X8PrimTyCon :: TyCon int32X8PrimTy :: Type int16X16PrimTyCon :: TyCon int16X16PrimTy :: Type int8X32PrimTyCon :: TyCon int8X32PrimTy :: Type int64X2PrimTyCon :: TyCon int64X2PrimTy :: Type int32X4PrimTyCon :: TyCon int32X4PrimTy :: Type int16X8PrimTyCon :: TyCon int16X8PrimTy :: Type int8X16PrimTyCon :: TyCon int8X16PrimTy :: Type threadIdPrimTyCon :: TyCon threadIdPrimTy :: Type mkWeakPrimTy :: Type -> Type weakPrimTyCon :: TyCon bcoPrimTyCon :: TyCon bcoPrimTy :: Type compactPrimTy :: Type compactPrimTyCon :: TyCon mkStableNamePrimTy :: Type -> Type stableNamePrimTyCon :: TyCon mkStablePtrPrimTy :: Type -> Type stablePtrPrimTyCon :: TyCon mkTVarPrimTy :: Type -> Type -> Type tVarPrimTyCon :: TyCon mkMVarPrimTy :: Type -> Type -> Type mVarPrimTyCon :: TyCon mkMutVarPrimTy :: Type -> Type -> Type mutVarPrimTyCon :: TyCon mkSmallMutableArrayPrimTy :: Type -> Type -> Type mkMutableArrayArrayPrimTy :: Type -> Type mkMutableByteArrayPrimTy :: Type -> Type mkMutableArrayPrimTy :: Type -> Type -> Type mkSmallArrayPrimTy :: Type -> Type mkArrayArrayPrimTy :: Type byteArrayPrimTy :: Type mkArrayPrimTy :: Type -> Type smallMutableArrayPrimTyCon :: TyCon smallArrayPrimTyCon :: TyCon mutableArrayArrayPrimTyCon :: TyCon arrayArrayPrimTyCon :: TyCon byteArrayPrimTyCon :: TyCon mutableByteArrayPrimTyCon :: TyCon mutableArrayPrimTyCon :: TyCon arrayPrimTyCon :: TyCon -- | Given a Role, what TyCon is the type of equality predicates at that -- role? equalityTyCon :: Role -> TyCon eqPhantPrimTyCon :: TyCon eqReprPrimTyCon :: TyCon eqPrimTyCon :: TyCon proxyPrimTyCon :: TyCon mkProxyPrimTy :: Type -> Type -> Type voidPrimTyCon :: TyCon voidPrimTy :: Type realWorldStatePrimTy :: Type realWorldTy :: Type realWorldTyCon :: TyCon statePrimTyCon :: TyCon mkStatePrimTy :: Type -> Type doublePrimTyCon :: TyCon doublePrimTy :: Type floatPrimTyCon :: TyCon floatPrimTy :: Type addrPrimTyCon :: TyCon addrPrimTy :: Type word64PrimTyCon :: TyCon word64PrimTy :: Type word32PrimTyCon :: TyCon word32PrimTy :: Type word16PrimTyCon :: TyCon word16PrimTy :: Type word8PrimTyCon :: TyCon word8PrimTy :: Type wordPrimTyCon :: TyCon wordPrimTy :: Type int64PrimTyCon :: TyCon int64PrimTy :: Type int32PrimTyCon :: TyCon int32PrimTy :: Type int16PrimTyCon :: TyCon int16PrimTy :: Type int8PrimTyCon :: TyCon int8PrimTy :: Type intPrimTyCon :: TyCon intPrimTy :: Type charPrimTyCon :: TyCon charPrimTy :: Type -- | Convert a PrimRep to a Type of kind RuntimeRep Defined -- here to avoid (more) module loops primRepToRuntimeRep :: PrimRep -> Type -- | Given a RuntimeRep, applies TYPE to it. see Note [TYPE and RuntimeRep] tYPE :: Type -> Type mkPrimTyConName :: FastString -> Unique -> TyCon -> Name tYPETyConName :: Name tYPETyCon :: TyCon -- | The (->) type constructor. -- --
--   (->) :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
--           TYPE rep1 -> TYPE rep2 -> *
--   
funTyCon :: TyCon funTyConName :: Name openBetaTy :: Type openAlphaTy :: Type openBetaTyVar :: TyVar openAlphaTyVar :: TyVar runtimeRep2Ty :: Type runtimeRep1Ty :: Type runtimeRep2TyVar :: TyVar runtimeRep1TyVar :: TyVar alphaTyUnliftedRep :: Type alphaTysUnliftedRep :: [Type] alphaTyVarUnliftedRep :: TyVar alphaTyVarsUnliftedRep :: [TyVar] deltaTy :: Type gammaTy :: Type betaTy :: Type alphaTy :: Type alphaTys :: [Type] deltaTyVar :: TyVar gammaTyVar :: TyVar betaTyVar :: TyVar alphaTyVar :: TyVar alphaTyVars :: [TyVar] mkTemplateAnonTyConBinders :: [Kind] -> [TyConBinder] mkTemplateKindTyConBinders :: [Kind] -> [TyConBinder] mkTemplateKiTyVar :: Kind -> (Kind -> [Kind]) -> [TyVar] mkTemplateKiTyVars :: [Kind] -> ([Kind] -> [Kind]) -> [TyVar] mkTemplateTyConBinders :: [Kind] -> ([Kind] -> [Kind]) -> [TyConBinder] mkTemplateTyVars :: [Kind] -> [TyVar] mkTemplateTyVarsFrom :: Int -> [Kind] -> [TyVar] mkTemplateKindVars :: [Kind] -> [TyVar] doublePrimTyConName :: Name floatPrimTyConName :: Name addrPrimTyConName :: Name word64PrimTyConName :: Name word32PrimTyConName :: Name word16PrimTyConName :: Name word8PrimTyConName :: Name wordPrimTyConName :: Name int64PrimTyConName :: Name int32PrimTyConName :: Name int16PrimTyConName :: Name int8PrimTyConName :: Name intPrimTyConName :: Name charPrimTyConName :: Name -- | Primitive TyCons that are defined in, and exported from, -- GHC.Prim. exposedPrimTyCons :: [TyCon] -- | Primitive TyCons that are defined in GHC.Prim but not -- exposed. It's important to keep these separate as we don't want users -- to be able to write them (see #15209) or see them in GHCi's -- :browse output (see #12023). unexposedPrimTyCons :: [TyCon] primTyCons :: [TyCon] provSize :: UnivCoProvenance -> Int coercionSize :: Coercion -> Int typeSize :: Type -> Int setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole coHoleCoVar :: CoercionHole -> CoVar -- | Create the plain type constructor type which has been applied to no -- type arguments at all. mkTyConTy :: TyCon -> Type mkPiTys :: [TyCoBinder] -> Type -> Type mkPiTy :: TyCoBinder -> Type -> Type -- | Wraps foralls over the type using the provided TyCoVars from -- left to right mkForAllTys :: [TyCoVarBinder] -> Type -> Type -- | Make nested arrow types mkInvisFunTys :: [Type] -> Type -> Type -- | Make nested arrow types mkVisFunTys :: [Type] -> Type -> Type mkInvisFunTy :: Type -> Type -> Type infixr 3 `mkInvisFunTy` mkVisFunTy :: Type -> Type -> Type infixr 3 `mkVisFunTy` mkTyCoVarTys :: [TyCoVar] -> [Type] mkTyCoVarTy :: TyCoVar -> Type mkTyVarTys :: [TyVar] -> [Type] mkTyVarTy :: TyVar -> Type -- | If its a named binder, is the binder a tyvar? Returns True for -- nondependent binder. This check that we're really returning a -- *Ty*Binder (as opposed to a coercion binder). That way, if/when we -- allow coercion quantification in more places, we'll know we missed -- updating some function. isTyBinder :: TyCoBinder -> Bool isNamedBinder :: TyCoBinder -> Bool -- | Does this binder bind a visible argument? isVisibleBinder :: TyCoBinder -> Bool -- | Does this binder bind an invisible argument? isInvisibleBinder :: TyCoBinder -> Bool -- | Remove the binder's variable from the set, if the binder has a -- variable. delBinderVar :: VarSet -> TyCoVarBinder -> VarSet tyThingCategory :: TyThing -> String pprTyThingCategory :: TyThing -> SDoc pprShortTyThing :: TyThing -> SDoc -- | The key representation of types within the compiler type KindOrType = Type -- | A type labeled KnotTied might have knot-tied tycons in it. See -- Note [Type checking recursive type and class declarations] in -- TcTyClsDecls type KnotTied ty = ty -- | TyBinder is like TyCoBinder, but there can only be -- TyVarBinder in the Named field. type TyBinder = TyCoBinder type CoercionR = Coercion type CoercionP = Coercion type KindCoercion = CoercionN type MCoercionR = MCoercion -- | A coercion to be filled in by the type-checker. See Note [Coercion -- holes] data CoercionHole CoercionHole :: CoVar -> IORef (Maybe Coercion) -> CoercionHole [ch_co_var] :: CoercionHole -> CoVar [ch_ref] :: CoercionHole -> IORef (Maybe Coercion) isCoercionTy :: Type -> Bool -- | Applies a type to another, as in e.g. k a mkAppTy :: Type -> Type -> Type -- | Make a CastTy. The Coercion must be nominal. Checks the -- Coercion for reflexivity, dropping it if it's reflexive. See Note -- [Respecting definitional equality] in TyCoRep mkCastTy :: Type -> Coercion -> Type piResultTy :: HasDebugCallStack => Type -> Type -> Type -- | Type equality on source types. Does not look through newtypes -- or PredTypes, but it does look through type synonyms. This -- first checks that the kinds of the types are equal and then checks -- whether the types are equal, ignoring casts and coercions. (The kind -- check is a recursive call, but since all kinds have type -- Type, there is no need to check the types of kinds.) See also -- Note [Non-trivial definitional equality] in TyCoRep. eqType :: Type -> Type -> Bool -- | This function Strips off the top layer only of a type synonym -- application (if any) its underlying representation type. Returns -- Nothing if there is nothing to look through. This function considers -- Constraint to be a synonym of TYPE LiftedRep. -- -- By being non-recursive and inlined, this case analysis gets -- efficiently joined onto the case analysis that the caller is already -- doing coreView :: Type -> Maybe Type -- | Gives the typechecker view of a type. This unwraps synonyms but leaves -- Constraint alone. c.f. coreView, which turns Constraint into -- TYPE LiftedRep. Returns Nothing if no unwrapping happens. See also -- Note [coreView vs tcView] tcView :: Type -> Maybe Type -- | Is this the type RuntimeRep? isRuntimeRepTy :: Type -> Bool -- | This version considers Constraint to be the same as *. Returns True if -- the argument is equivalent to Type/Constraint and False otherwise. See -- Note [Kind Constraint and kind Type] isLiftedTypeKind :: Kind -> Bool -- | Attempts to tease a type apart into a type constructor and the -- application of a number of arguments to that constructor splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) -- | Given a TyCon and a list of argument types, partition the -- arguments into: -- --
    --
  1. Inferred or Specified (i.e., invisible) arguments -- and
  2. --
  3. Required (i.e., visible) arguments
  4. --
partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type]) -- | Returns whether or not this TyCon is definite, or a hole that -- may be filled in at some later point. See Note [Skolem abstract data] tyConSkolem :: TyCon -> Bool checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker -- | Change the upper bound for the number of times a RecTcChecker -- is allowed to encounter each TyCon. setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker -- | The default upper bound (100) for the number of times a -- RecTcChecker is allowed to encounter each TyCon. defaultRecTcMaxBound :: Int -- | Initialise a RecTcChecker with defaultRecTcMaxBound. initRecTc :: RecTcChecker pprPromotionQuote :: TyCon -> SDoc -- | Is this flavour of TyCon an open type family or a data family? tcFlavourIsOpen :: TyConFlavour -> Bool tyConFlavour :: TyCon -> TyConFlavour mkTyConTagMap :: TyCon -> NameEnv ConTag -- | Extract any RuntimeRepInfo from this TyCon tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo -- | If this TyCon is that of a data family instance, return a -- TyCon which represents a coercion identifying the -- representation type with the type instance family. Otherwise, return -- Nothing tyConFamilyCoercion_maybe :: TyCon -> Maybe (CoAxiom Unbranched) -- | If this TyCon is that of a data family instance, return the -- family in question and the instance types. Otherwise, return -- Nothing tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type]) tyConFamInstSig_maybe :: TyCon -> Maybe (TyCon, [Type], CoAxiom Unbranched) -- | Is this TyCon that for a data family instance? isFamInstTyCon :: TyCon -> Bool -- | Return the associated types of the TyCon, if any tyConATs :: TyCon -> [TyCon] -- | If this TyCon is that for a class instance, return the class it -- is for. Otherwise returns Nothing tyConClass_maybe :: TyCon -> Maybe Class -- | Is this TyCon that for a class instance? isClassTyCon :: TyCon -> Bool -- | Extract the flavour of a type family (with all the extra information -- that it carries) famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav -- | Extract the information pertaining to the right hand side of a type -- synonym (type) declaration. synTyConRhs_maybe :: TyCon -> Maybe Type -- | Extract the TyVars bound by a vanilla type synonym and the -- corresponding (unsubstituted) right hand side. synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type) -- | Find the "stupid theta" of the TyCon. A "stupid theta" is the -- context to the left of an algebraic type declaration, e.g. Eq -- a in the declaration data Eq a => T a ... tyConStupidTheta :: TyCon -> [PredType] newTyConDataCon_maybe :: TyCon -> Maybe DataCon newTyConCo :: TyCon -> CoAxiom Unbranched -- | Extracts the newtype coercion from such a TyCon, which -- can be used to construct something with the newtypes type -- from its representation type (right hand side). If the supplied -- TyCon is not a newtype, returns Nothing newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched) -- | Extract the bound type variables and type expansion of an -- eta-contracted type synonym TyCon. Panics if the TyCon -- is not a synonym newTyConEtadRhs :: TyCon -> ([TyVar], Type) -- | The number of type parameters that need to be passed to a newtype to -- resolve it. May be less than in the definition if it can be -- eta-contracted. newTyConEtadArity :: TyCon -> Int -- | Extract the bound type variables and type expansion of a type synonym -- TyCon. Panics if the TyCon is not a synonym newTyConRhs :: TyCon -> ([TyVar], Type) -- | Get the list of roles for the type parameters of a TyCon tyConRoles :: TyCon -> [Role] -- | Extract type variable naming the result of injective type family tyConFamilyResVar_maybe :: TyCon -> Maybe Name -- | Extract an AlgTyConRhs with information about data constructors -- from an algebraic or tuple TyCon. Panics for any other sort of -- TyCon algTyConRhs :: TyCon -> AlgTyConRhs -- | Determine the number of value constructors a TyCon has. Panics -- if the TyCon is not algebraic or a tuple tyConFamilySize :: TyCon -> Int tyConSingleAlgDataCon_maybe :: TyCon -> Maybe DataCon tyConSingleDataCon :: TyCon -> DataCon -- | If the given TyCon has a single data constructor, i.e. -- it is a data type with one alternative, a tuple type or a -- newtype then that constructor is returned. If the -- TyCon has more than one constructor, or represents a primitive -- or function type constructor then Nothing is returned. In any -- other case, the function panics tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon -- | Determine the DataCons originating from the given TyCon, -- if the TyCon is the sort that can have any constructors (note: -- this does not include abstract algebraic types) tyConDataCons_maybe :: TyCon -> Maybe [DataCon] -- | As tyConDataCons_maybe, but returns the empty list of -- constructors if no constructors could be found tyConDataCons :: TyCon -> [DataCon] -- | Check if the tycon actually refers to a proper `data` or `newtype` -- with user defined constructors rather than one from a class or other -- construction. isTyConWithSrcDataCons :: TyCon -> Bool -- | Expand a type synonym application, if any expandSynTyCon_maybe :: TyCon -> [tyco] -> Maybe ([(TyVar, tyco)], Type, [tyco]) -- | Could this TyCon ever be levity-polymorphic when fully applied? True -- is safe. False means we're sure. Does only a quick check based on the -- TyCon's category. Precondition: The fully-applied TyCon has kind (TYPE -- blah) isTcLevPoly :: TyCon -> Bool setTcTyConKind :: TyCon -> Kind -> TyCon -- | Is this a TcTyCon? (That is, one only used during type-checking?) isTcTyCon :: TyCon -> Bool tyConCType_maybe :: TyCon -> Maybe CType -- | Identifies implicit tycons that, in particular, do not go into -- interface files (because they are implicitly reconstructed when the -- interface is read). -- -- Note that: -- -- isImplicitTyCon :: TyCon -> Bool isLiftedTypeKindTyConName :: Name -> Bool -- | Is this tycon really meant for use at the kind level? That is, should -- it be permitted without -XDataKinds? isKindTyCon :: TyCon -> Bool -- | Retrieves the promoted DataCon if this is a PromotedDataCon; isPromotedDataCon_maybe :: TyCon -> Maybe DataCon -- | Is this a PromotedDataCon? isPromotedDataCon :: TyCon -> Bool -- | Is this the TyCon for a promoted tuple? isPromotedTupleTyCon :: TyCon -> Bool -- | Is this the TyCon for an unboxed sum? isUnboxedSumTyCon :: TyCon -> Bool -- | Is this the TyCon for a boxed tuple? isBoxedTupleTyCon :: TyCon -> Bool tyConTuple_maybe :: TyCon -> Maybe TupleSort -- | Get the enclosing class TyCon (if there is one) for the given -- TyConFlavour tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon -- | Get the enclosing class TyCon (if there is one) for the given TyCon. tyConAssoc_maybe :: TyCon -> Maybe TyCon -- | Is this TyCon for an associated type? isTyConAssoc :: TyCon -> Bool isBuiltInSynFamTyCon_maybe :: TyCon -> Maybe BuiltInSynFamily -- | tyConInjectivityInfo tc returns Injective -- is is tc is an injective tycon (where is states -- for which tyConBinders tc is injective), or -- NotInjective otherwise. tyConInjectivityInfo :: TyCon -> Injectivity -- | Is this a non-empty closed type family? Returns Nothing for -- abstract or empty closed families. isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched) -- | Is this an open type family TyCon? isOpenTypeFamilyTyCon :: TyCon -> Bool -- | Is this a synonym TyCon that can have may have further -- instances appear? isDataFamilyTyCon :: TyCon -> Bool -- | Is this a synonym TyCon that can have may have further -- instances appear? isTypeFamilyTyCon :: TyCon -> Bool -- | Is this a TyCon, synonym or otherwise, that defines a family -- with instances? isOpenFamilyTyCon :: TyCon -> Bool -- | Is this a TyCon, synonym or otherwise, that defines a family? isFamilyTyCon :: TyCon -> Bool -- | Is this an algebraic TyCon which is just an enumeration of -- values? isEnumerationTyCon :: TyCon -> Bool -- | Is this an algebraic TyCon declared with the GADT syntax? isGadtSyntaxTyCon :: TyCon -> Bool -- | True iff we can decompose (T a b c) into ((T a b) c) I.e. is it -- injective and generative w.r.t nominal equality? That is, if (T a b) -- ~N d e f, is it always the case that (T ~N d), (a ~N e) and (b ~N f)? -- Specifically NOT true of synonyms (open and otherwise) -- -- It'd be unusual to call mustBeSaturated on a regular H98 type synonym, -- because you should probably have expanded it first But regardless, -- it's not decomposable mustBeSaturated :: TyCon -> Bool isFamFreeTyCon :: TyCon -> Bool isTauTyCon :: TyCon -> Bool -- | Is this a TyCon representing a regular H98 type synonym -- (type)? isTypeSynonymTyCon :: TyCon -> Bool isDataSumTyCon_maybe :: TyCon -> Maybe [DataCon] isDataProductTyCon_maybe :: TyCon -> Maybe DataCon isProductTyCon :: TyCon -> Bool unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) -- | Take a TyCon apart into the TyVars it scopes over, the -- Type it expands into, and (possibly) a coercion from the -- representation type to the newtype. Returns Nothing -- if this is not possible. unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) -- | Is this TyCon that for a newtype isNewTyCon :: TyCon -> Bool -- | Is this an AlgTyConRhs of a TyCon that is generative and -- injective with respect to representational equality? isGenInjAlgRhs :: AlgTyConRhs -> Bool -- | isGenerativeTyCon is true of TyCons for which this -- property holds (where X is the role passed in): If (T tys ~X t), then -- (t's head ~X T). See also Note [Decomposing equality] in TcCanonical isGenerativeTyCon :: TyCon -> Role -> Bool -- | isInjectiveTyCon is true of TyCons for which this -- property holds (where X is the role passed in): If (T a1 b1 c1) ~X (T -- a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2) (where X1, -- X2, and X3, are the roles given by tyConRolesX tc X) See also Note -- [Decomposing equality] in TcCanonical isInjectiveTyCon :: TyCon -> Role -> Bool -- | Returns True for data types that are definitely -- represented by heap-allocated constructors. These are scrutinised by -- Core-level case expressions, and they get info tables -- allocated for them. -- -- Generally, the function will be true for all data types and -- false for newtypes, unboxed tuples, unboxed sums and type -- family TyCons. But it is not guaranteed to return True -- in all cases that it could. -- -- NB: for a data type family, only the instance TyCons get -- an info table. The family declaration TyCon does not isDataTyCon :: TyCon -> Bool -- | Returns True for vanilla AlgTyCons -- that is, those created -- with a data or newtype declaration. isVanillaAlgTyCon :: TyCon -> Bool -- | Returns True if the supplied TyCon resulted from -- either a data or newtype declaration isAlgTyCon :: TyCon -> Bool -- | Is this TyCon unlifted (i.e. cannot contain bottom)? Note that -- this can only be true for primitive and unboxed-tuple TyCons isUnliftedTyCon :: TyCon -> Bool -- | Does this TyCon represent something that cannot be defined in -- Haskell? isPrimTyCon :: TyCon -> Bool -- | Test if the TyCon is algebraic but abstract (invisible data -- constructors) isAbstractTyCon :: TyCon -> Bool -- | Create a promoted data constructor TyCon Somewhat dodgily, we -- give it the same Name as the data constructor itself; when we -- pretty-print the TyCon we add a quote; see the Outputable TyCon -- instance mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon -- | Create a type family TyCon mkFamilyTyCon :: Name -> [TyConBinder] -> Kind -> Maybe Name -> FamTyConFlav -> Maybe Class -> Injectivity -> TyCon -- | Create a type synonym TyCon mkSynonymTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> Bool -> Bool -> TyCon -- | Create a lifted primitive TyCon such as RealWorld mkLiftedPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon -- | Kind constructors mkKindTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Name -> TyCon -- | Create an unlifted primitive TyCon, such as Int#. mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon -- | No scoped type variables (to be used with mkTcTyCon). noTcTyConScopedTyVars :: [(Name, TcTyVar)] -- | Makes a tycon suitable for use during type-checking. It stores a -- variety of details about the definition of the TyCon, but no -- right-hand side. It lives only during the type-checking of a -- mutually-recursive group of tycons; it is then zonked to a proper -- TyCon in zonkTcTyCon. See also Note [Kind checking recursive type and -- class declarations] in TcTyClsDecls. mkTcTyCon :: Name -> [TyConBinder] -> Kind -> [(Name, TcTyVar)] -> Bool -> TyConFlavour -> TyCon mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon -- | Simpler specialization of mkAlgTyCon for classes mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon -- | This is the making of an algebraic TyCon. Notably, you have to -- pass in the generic (in the -XGenerics sense) information about the -- type constructor - you can get hold of it easily (see Generics module) mkAlgTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Maybe CType -> [PredType] -> AlgTyConRhs -> AlgTyConFlav -> Bool -> TyCon -- | Given the name of the function type constructor and it's kind, create -- the corresponding TyCon. It is recommended to use -- funTyCon if you want this functionality mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon -- | Look up a field label belonging to this TyCon lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel -- | The labels for the fields of this particular TyCon tyConFieldLabels :: TyCon -> [FieldLabel] -- | Return if Rep stands for floating type, returns Nothing for vector -- types. primRepIsFloat :: PrimRep -> Maybe Bool primElemRepSizeB :: PrimElemRep -> Int -- | The size of a PrimRep in bytes. -- -- This applies also when used in a constructor, where we allow packing -- the fields. For instance, in data Foo = Foo Float the two -- fields will take only 8 bytes, which for 64-bit arch will be equal to -- 1 word. See also mkVirtHeapOffsetsWithPadding for details of how data -- fields are layed out. primRepSizeB :: DynFlags -> PrimRep -> Int primRepsCompatible :: DynFlags -> [PrimRep] -> [PrimRep] -> Bool primRepCompatible :: DynFlags -> PrimRep -> PrimRep -> Bool isGcPtrRep :: PrimRep -> Bool isVoidRep :: PrimRep -> Bool -- | The name (and defining module) for the Typeable representation (TyCon) -- of a type constructor. -- -- See Note [Grand plan for Typeable] in TcTypeable in -- TcTypeable. tyConRepModOcc :: Module -> OccName -> (Module, OccName) -- | Make a Name for the Typeable representation of the -- given wired-in type mkPrelTyConRepName :: Name -> TyConRepName tyConRepName_maybe :: TyCon -> Maybe TyConRepName isNoParent :: AlgTyConFlav -> Bool -- | Both type classes as well as family instances imply implicit type -- constructors. These implicit type constructors refer to their parent -- structure (ie, the class or family from which they derive) using a -- type of the following form. -- -- Extract those DataCons that we are able to learn about. Note -- that visibility in this sense does not correspond to visibility in the -- context of any particular user program! visibleDataCons :: AlgTyConRhs -> [DataCon] mkDataTyConRhs :: [DataCon] -> AlgTyConRhs tyConVisibleTyVars :: TyCon -> [TyVar] tyConTyVarBinders :: [TyConBinder] -> [TyVarBinder] mkTyConKind :: [TyConBinder] -> Kind -> Kind isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool isNamedTyConBinder :: TyConBinder -> Bool tyConBndrVisArgFlag :: TyConBndrVis -> ArgFlag tyConBinderArgFlag :: TyConBinder -> ArgFlag -- | Make a Required TyConBinder. It chooses between NamedTCB and AnonTCB -- based on whether the tv is mentioned in the dependent set mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder] mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder] mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder type TyConBinder = VarBndr TyVar TyConBndrVis type TyConTyCoBinder = VarBndr TyCoVar TyConBndrVis data TyConBndrVis NamedTCB :: ArgFlag -> TyConBndrVis AnonTCB :: AnonArgFlag -> TyConBndrVis -- | Represents right-hand-sides of TyCons for algebraic types data AlgTyConRhs -- | Says that we know nothing about this data type, except that it's -- represented by a pointer. Used when we export a data type abstractly -- into an .hi file. AbstractTyCon :: AlgTyConRhs -- | Information about those TyCons derived from a data -- declaration. This includes data types with no constructors at all. DataTyCon :: [DataCon] -> Int -> Bool -> AlgTyConRhs -- | The data type constructors; can be empty if the user declares the type -- to have no constructors -- -- INVARIANT: Kept in order of increasing DataCon tag (see the tag -- assignment in mkTyConTagMap) [data_cons] :: AlgTyConRhs -> [DataCon] -- | Cached value: length data_cons [data_cons_size] :: AlgTyConRhs -> Int -- | Cached value: is this an enumeration type? See Note [Enumeration -- types] [is_enum] :: AlgTyConRhs -> Bool TupleTyCon :: DataCon -> TupleSort -> AlgTyConRhs -- | The unique constructor for the newtype. It has no -- existentials [data_con] :: AlgTyConRhs -> DataCon -- | Is this a boxed, unboxed or constraint tuple? [tup_sort] :: AlgTyConRhs -> TupleSort -- | An unboxed sum type. SumTyCon :: [DataCon] -> Int -> AlgTyConRhs -- | The data type constructors; can be empty if the user declares the type -- to have no constructors -- -- INVARIANT: Kept in order of increasing DataCon tag (see the tag -- assignment in mkTyConTagMap) [data_cons] :: AlgTyConRhs -> [DataCon] -- | Cached value: length data_cons [data_cons_size] :: AlgTyConRhs -> Int -- | Information about those TyCons derived from a newtype -- declaration NewTyCon :: DataCon -> Type -> ([TyVar], Type) -> CoAxiom Unbranched -> Bool -> AlgTyConRhs -- | The unique constructor for the newtype. It has no -- existentials [data_con] :: AlgTyConRhs -> DataCon -- | Cached value: the argument type of the constructor, which is just the -- representation type of the TyCon (remember that -- newtypes do not exist at runtime so need a different -- representation type). -- -- The free TyVars of this type are the tyConTyVars from -- the corresponding TyCon [nt_rhs] :: AlgTyConRhs -> Type -- | Same as the nt_rhs, but this time eta-reduced. Hence the list -- of TyVars in this field may be shorter than the declared arity -- of the TyCon. [nt_etad_rhs] :: AlgTyConRhs -> ([TyVar], Type) [nt_co] :: AlgTyConRhs -> CoAxiom Unbranched [nt_lev_poly] :: AlgTyConRhs -> Bool -- | Some promoted datacons signify extra info relevant to GHC. For -- example, the IntRep constructor of RuntimeRep -- corresponds to the IntRep constructor of PrimRep. This -- data structure allows us to store this information right in the -- TyCon. The other approach would be to look up things like -- RuntimeRep's PrimRep by known-key every time. See -- also Note [Getting from RuntimeRep to PrimRep] in RepType data RuntimeRepInfo -- | an ordinary promoted data con NoRRI :: RuntimeRepInfo -- | A constructor of RuntimeRep. The argument to the function -- should be the list of arguments to the promoted datacon. RuntimeRep :: ([Type] -> [PrimRep]) -> RuntimeRepInfo -- | A constructor of VecCount VecCount :: Int -> RuntimeRepInfo -- | A constructor of VecElem VecElem :: PrimElemRep -> RuntimeRepInfo data AlgTyConFlav -- | An ordinary type constructor has no parent. VanillaAlgTyCon :: TyConRepName -> AlgTyConFlav -- | An unboxed type constructor. The TyConRepName is a Maybe since we -- currently don't allow unboxed sums to be Typeable since there are too -- many of them. See #13276. UnboxedAlgTyCon :: Maybe TyConRepName -> AlgTyConFlav -- | Type constructors representing a class dictionary. See Note [ATyCon -- for classes] in TyCoRep ClassTyCon :: Class -> TyConRepName -> AlgTyConFlav -- | Type constructors representing an *instance* of a *data* family. -- Parameters: -- -- 1) The type family in question -- -- 2) Instance types; free variables are the tyConTyVars of the -- current TyCon (not the family one). INVARIANT: the number of -- types matches the arity of the family TyCon -- -- 3) A CoTyCon identifying the representation type with the -- type instance family DataFamInstTyCon :: CoAxiom Unbranched -> TyCon -> [Type] -> AlgTyConFlav data Injectivity NotInjective :: Injectivity Injective :: [Bool] -> Injectivity -- | Information pertaining to the expansion of a type synonym -- (type) data FamTyConFlav -- | Represents an open type family without a fixed right hand side. -- Additional instances can appear at any time. -- -- These are introduced by either a top level declaration: -- --
--   data family T a :: *
--   
-- -- Or an associated data type declaration, within a class declaration: -- --
--   class C a b where
--     data T b :: *
--   
DataFamilyTyCon :: TyConRepName -> FamTyConFlav -- | An open type synonym family e.g. type family F x y :: * -> -- * OpenSynFamilyTyCon :: FamTyConFlav -- | A closed type synonym family e.g. type family F x where { F Int = -- Bool } ClosedSynFamilyTyCon :: Maybe (CoAxiom Branched) -> FamTyConFlav -- | A closed type synonym family declared in an hs-boot file with type -- family F a where .. AbstractClosedSynFamilyTyCon :: FamTyConFlav -- | Built-in type family used by the TypeNats solver BuiltInSynFamTyCon :: BuiltInSynFamily -> FamTyConFlav type TyConRepName = Name -- | A PrimRep is an abstraction of a type. It contains information -- that the code generator needs in order to pass arguments, return -- results, and store values of this type. See also Note [RuntimeRep and -- PrimRep] in RepType and Note [VoidRep] in RepType. data PrimRep VoidRep :: PrimRep LiftedRep :: PrimRep -- | Unlifted pointer UnliftedRep :: PrimRep -- | Signed, 8-bit value Int8Rep :: PrimRep -- | Signed, 16-bit value Int16Rep :: PrimRep -- | Signed, 32-bit value Int32Rep :: PrimRep -- | Signed, 64 bit value (with 32-bit words only) Int64Rep :: PrimRep -- | Signed, word-sized value IntRep :: PrimRep -- | Unsigned, 8 bit value Word8Rep :: PrimRep -- | Unsigned, 16 bit value Word16Rep :: PrimRep -- | Unsigned, 32 bit value Word32Rep :: PrimRep -- | Unsigned, 64 bit value (with 32-bit words only) Word64Rep :: PrimRep -- | Unsigned, word-sized value WordRep :: PrimRep -- | A pointer, but not to a Haskell value (use '(Un)liftedRep') AddrRep :: PrimRep FloatRep :: PrimRep DoubleRep :: PrimRep -- | A vector VecRep :: Int -> PrimElemRep -> PrimRep data PrimElemRep Int8ElemRep :: PrimElemRep Int16ElemRep :: PrimElemRep Int32ElemRep :: PrimElemRep Int64ElemRep :: PrimElemRep Word8ElemRep :: PrimElemRep Word16ElemRep :: PrimElemRep Word32ElemRep :: PrimElemRep Word64ElemRep :: PrimElemRep FloatElemRep :: PrimElemRep DoubleElemRep :: PrimElemRep -- | Paints a picture of what a TyCon represents, in broad strokes. -- This is used towards more informative error messages. data TyConFlavour ClassFlavour :: TyConFlavour TupleFlavour :: Boxity -> TyConFlavour SumFlavour :: TyConFlavour DataTypeFlavour :: TyConFlavour NewtypeFlavour :: TyConFlavour AbstractTypeFlavour :: TyConFlavour DataFamilyFlavour :: Maybe TyCon -> TyConFlavour OpenTypeFamilyFlavour :: Maybe TyCon -> TyConFlavour ClosedTypeFamilyFlavour :: TyConFlavour TypeSynonymFlavour :: TyConFlavour -- | e.g., the (->) TyCon. BuiltInTypeFlavour :: TyConFlavour PromotedDataConFlavour :: TyConFlavour data RecTcChecker pprFunDep :: Outputable a => FunDep a -> SDoc pprFundeps :: Outputable a => [FunDep a] -> SDoc pprDefMethInfo :: DefMethInfo -> SDoc isAbstractClass :: Class -> Bool classExtraBigSig :: Class -> ([TyVar], [FunDep TyVar], [PredType], [Id], [ClassATItem], [ClassOpItem]) classBigSig :: Class -> ([TyVar], [PredType], [Id], [ClassOpItem]) classHasFds :: Class -> Bool classTvsFds :: Class -> ([TyVar], [FunDep TyVar]) classSCTheta :: Class -> [PredType] classATItems :: Class -> [ClassATItem] classATs :: Class -> [TyCon] classOpItems :: Class -> [ClassOpItem] classMethods :: Class -> [Id] classSCSelId :: Class -> Int -> Id classSCSelIds :: Class -> [Id] classAllSelIds :: Class -> [Id] classArity :: Class -> Arity mkAbstractClass :: Name -> [TyVar] -> [FunDep TyVar] -> TyCon -> Class mkClass :: Name -> [TyVar] -> [FunDep TyVar] -> [PredType] -> [Id] -> [ClassATItem] -> [ClassOpItem] -> ClassMinimalDef -> TyCon -> Class classMinimalDef :: Class -> ClassMinimalDef data Class type FunDep a = ([a], [a]) type ClassOpItem = (Id, DefMethInfo) type DefMethInfo = Maybe (Name, DefMethSpec Type) data ClassATItem ATI :: TyCon -> Maybe (Type, SrcSpan) -> ClassATItem type ClassMinimalDef = BooleanFormula Name data Role Nominal :: Role Representational :: Role Phantom :: Role conLikeName :: ConLike -> Name -- | A constructor-like thing data ConLike RealDataCon :: DataCon -> ConLike PatSynCon :: PatSyn -> ConLike -- | The Name of the DataCon, giving it a unique, rooted -- identification dataConName :: DataCon -> Name -- | The type constructor that we are building via this data constructor dataConTyCon :: DataCon -> TyCon -- | The existentially-quantified type/coercion variables of the -- constructor including dependent (kind-) GADT equalities dataConExTyCoVars :: DataCon -> [TyCoVar] -- | The type variables of the constructor, in the order the user wrote -- them dataConUserTyVars :: DataCon -> [TyVar] -- | TyCoVarBinders for the type variables of the constructor, in -- the order the user wrote them dataConUserTyVarBinders :: DataCon -> [TyVarBinder] -- | Source-level arity of the data constructor dataConSourceArity :: DataCon -> Arity -- | The labels for the fields of this particular DataCon dataConFieldLabels :: DataCon -> [FieldLabel] -- | Returns just the instantiated value argument types of a -- DataCon, (excluding dictionary args) dataConInstOrigArgTys :: DataCon -> [Type] -> [Type] -- | The "stupid theta" of the DataCon, such as data Eq a -- in: -- --
--   data Eq a => T a = ...
--   
dataConStupidTheta :: DataCon -> ThetaType -- | The "full signature" of the DataCon returns, in order: -- -- 1) The result of dataConUnivTyVars -- -- 2) The result of dataConExTyCoVars -- -- 3) The non-dependent GADT equalities. Dependent GADT equalities are -- implied by coercion variables in return value (2). -- -- 4) The other constraints of the data constructor type, excluding GADT -- equalities -- -- 5) The original argument types to the DataCon (i.e. before any -- change of the representation of the type) -- -- 6) The original result type of the DataCon dataConFullSig :: DataCon -> ([TyVar], [TyCoVar], [EqSpec], ThetaType, [Type], Type) isUnboxedSumCon :: DataCon -> Bool -- | A data constructor -- -- data DataCon -- | Data Constructor Representation See Note [Data constructor workers and -- wrappers] data DataConRep NoDataConRep :: DataConRep DCR :: Id -> DataConBoxer -> [Type] -> [StrictnessMark] -> [HsImplBang] -> DataConRep [dcr_wrap_id] :: DataConRep -> Id [dcr_boxer] :: DataConRep -> DataConBoxer [dcr_arg_tys] :: DataConRep -> [Type] [dcr_stricts] :: DataConRep -> [StrictnessMark] [dcr_bangs] :: DataConRep -> [HsImplBang] -- | An EqSpec is a tyvar/type pair representing an equality made in -- rejigging a GADT constructor data EqSpec pprLExpr :: forall (p :: Pass). OutputableBndrId p => LHsExpr (GhcPass p) -> SDoc pprExpr :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> SDoc pprSplice :: forall (p :: Pass). OutputableBndrId p => HsSplice (GhcPass p) -> SDoc pprSpliceDecl :: forall (p :: Pass). OutputableBndrId p => HsSplice (GhcPass p) -> SpliceExplicitFlag -> SDoc pprPatBind :: forall (bndr :: Pass) (p :: Pass) body. (OutputableBndrId bndr, OutputableBndrId p, Outputable body) => LPat (GhcPass bndr) -> GRHSs (GhcPass p) body -> SDoc pprFunBind :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable body) => MatchGroup (GhcPass idR) body -> SDoc -- | A Haskell expression. data HsExpr p -- | Variable HsVar :: XVar p -> Located (IdP p) -> HsExpr p -- | Unbound variable; also used for "holes" (_ or _x). Turned from HsVar -- to HsUnboundVar by the renamer, when it finds an out-of-scope variable -- or hole. Turned into HsVar by type checker, to support deferred type -- errors. HsUnboundVar :: XUnboundVar p -> UnboundVar -> HsExpr p -- | After typechecker only; must be different HsVar for pretty printing HsConLikeOut :: XConLikeOut p -> ConLike -> HsExpr p -- | Variable pointing to record selector Not in use after typechecking HsRecFld :: XRecFld p -> AmbiguousFieldOcc p -> HsExpr p -- | Overloaded label (Note [Overloaded labels] in GHC.OverloadedLabels) -- Just id means RebindableSyntax is in use, and gives -- the id of the in-scope fromLabel. NB: Not in use after -- typechecking HsOverLabel :: XOverLabel p -> Maybe (IdP p) -> FastString -> HsExpr p -- | Implicit parameter (not in use after typechecking) HsIPVar :: XIPVar p -> HsIPName -> HsExpr p -- | Overloaded literals HsOverLit :: XOverLitE p -> HsOverLit p -> HsExpr p -- | Simple (non-overloaded) literals HsLit :: XLitE p -> HsLit p -> HsExpr p -- | Lambda abstraction. Currently always a single match -- -- HsLam :: XLam p -> MatchGroup p (LHsExpr p) -> HsExpr p -- | Lambda-case -- -- HsLamCase :: XLamCase p -> MatchGroup p (LHsExpr p) -> HsExpr p -- | Application HsApp :: XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p -- | Visible type application -- -- Explicit type argument; e.g f @Int x y NB: Has wildcards, but no -- implicit quantification -- -- HsAppType :: XAppTypeE p -> LHsExpr p -> LHsWcType (NoGhcTc p) -> HsExpr p -- | Operator applications: NB Bracketed ops such as (+) come out as Vars. OpApp :: XOpApp p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p -- | Negation operator. Contains the negated expression and the name of -- negate -- -- NegApp :: XNegApp p -> LHsExpr p -> SyntaxExpr p -> HsExpr p -- | Parenthesised expr; see Note [Parens in HsSyn] HsPar :: XPar p -> LHsExpr p -> HsExpr p SectionL :: XSectionL p -> LHsExpr p -> LHsExpr p -> HsExpr p SectionR :: XSectionR p -> LHsExpr p -> LHsExpr p -> HsExpr p -- | Used for explicit tuples and sections thereof -- -- ExplicitTuple :: XExplicitTuple p -> [LHsTupArg p] -> Boxity -> HsExpr p -- | Used for unboxed sum types -- -- -- -- There will be multiple AnnVbar, (1 - alternative) before the -- expression, (arity - alternative) after it ExplicitSum :: XExplicitSum p -> ConTag -> Arity -> LHsExpr p -> HsExpr p -- | HsCase :: XCase p -> LHsExpr p -> MatchGroup p (LHsExpr p) -> HsExpr p -- | HsIf :: XIf p -> Maybe (SyntaxExpr p) -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p -- | Multi-way if -- -- HsMultiIf :: XMultiIf p -> [LGRHS p (LHsExpr p)] -> HsExpr p -- | let(rec) -- -- HsLet :: XLet p -> LHsLocalBinds p -> LHsExpr p -> HsExpr p -- | HsDo :: XDo p -> HsStmtContext Name -> Located [ExprLStmt p] -> HsExpr p -- | Syntactic list: [a,b,c,...] -- -- ExplicitList :: XExplicitList p -> Maybe (SyntaxExpr p) -> [LHsExpr p] -> HsExpr p -- | Record construction -- -- RecordCon :: XRecordCon p -> Located (IdP p) -> HsRecordBinds p -> HsExpr p [rcon_ext] :: HsExpr p -> XRecordCon p [rcon_con_name] :: HsExpr p -> Located (IdP p) [rcon_flds] :: HsExpr p -> HsRecordBinds p -- | Record update -- -- RecordUpd :: XRecordUpd p -> LHsExpr p -> [LHsRecUpdField p] -> HsExpr p [rupd_ext] :: HsExpr p -> XRecordUpd p [rupd_expr] :: HsExpr p -> LHsExpr p [rupd_flds] :: HsExpr p -> [LHsRecUpdField p] -- | Expression with an explicit type signature. e :: type -- -- ExprWithTySig :: XExprWithTySig p -> LHsExpr p -> LHsSigWcType (NoGhcTc p) -> HsExpr p -- | Arithmetic sequence -- -- ArithSeq :: XArithSeq p -> Maybe (SyntaxExpr p) -> ArithSeqInfo p -> HsExpr p HsSCC :: XSCC p -> SourceText -> StringLiteral -> LHsExpr p -> HsExpr p -- | HsCoreAnn :: XCoreAnn p -> SourceText -> StringLiteral -> LHsExpr p -> HsExpr p -- | HsBracket :: XBracket p -> HsBracket p -> HsExpr p HsRnBracketOut :: XRnBracketOut p -> HsBracket GhcRn -> [PendingRnSplice] -> HsExpr p HsTcBracketOut :: XTcBracketOut p -> HsBracket GhcRn -> [PendingTcSplice] -> HsExpr p -- | HsSpliceE :: XSpliceE p -> HsSplice p -> HsExpr p -- | proc notation for Arrows -- -- HsProc :: XProc p -> LPat p -> LHsCmdTop p -> HsExpr p -- | HsStatic :: XStatic p -> LHsExpr p -> HsExpr p HsTick :: XTick p -> Tickish (IdP p) -> LHsExpr p -> HsExpr p HsBinTick :: XBinTick p -> Int -> Int -> LHsExpr p -> HsExpr p -- | HsTickPragma :: XTickPragma p -> SourceText -> (StringLiteral, (Int, Int), (Int, Int)) -> ((SourceText, SourceText), (SourceText, SourceText)) -> LHsExpr p -> HsExpr p HsWrap :: XWrap p -> HsWrapper -> HsExpr p -> HsExpr p XExpr :: XXExpr p -> HsExpr p -- | Haskell Command (e.g. a "statement" in an Arrow proc block) data HsCmd id -- | HsCmdArrApp :: XCmdArrApp id -> LHsExpr id -> LHsExpr id -> HsArrAppType -> Bool -> HsCmd id -- | HsCmdArrForm :: XCmdArrForm id -> LHsExpr id -> LexicalFixity -> Maybe Fixity -> [LHsCmdTop id] -> HsCmd id HsCmdApp :: XCmdApp id -> LHsCmd id -> LHsExpr id -> HsCmd id -- | HsCmdLam :: XCmdLam id -> MatchGroup id (LHsCmd id) -> HsCmd id -- | HsCmdPar :: XCmdPar id -> LHsCmd id -> HsCmd id -- | HsCmdCase :: XCmdCase id -> LHsExpr id -> MatchGroup id (LHsCmd id) -> HsCmd id -- | HsCmdIf :: XCmdIf id -> Maybe (SyntaxExpr id) -> LHsExpr id -> LHsCmd id -> LHsCmd id -> HsCmd id -- | HsCmdLet :: XCmdLet id -> LHsLocalBinds id -> LHsCmd id -> HsCmd id -- | HsCmdDo :: XCmdDo id -> Located [CmdLStmt id] -> HsCmd id HsCmdWrap :: XCmdWrap id -> HsWrapper -> HsCmd id -> HsCmd id XCmd :: XXCmd id -> HsCmd id -- | Haskell Splice data HsSplice id HsTypedSplice :: XTypedSplice id -> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id HsUntypedSplice :: XUntypedSplice id -> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id HsQuasiQuote :: XQuasiQuote id -> IdP id -> IdP id -> SrcSpan -> FastString -> HsSplice id HsSpliced :: XSpliced id -> ThModFinalizers -> HsSplicedThing id -> HsSplice id HsSplicedT :: DelayedSplice -> HsSplice id XSplice :: XXSplice id -> HsSplice id data MatchGroup p body MG :: XMG p body -> Located [LMatch p body] -> Origin -> MatchGroup p body [mg_ext] :: MatchGroup p body -> XMG p body [mg_alts] :: MatchGroup p body -> Located [LMatch p body] [mg_origin] :: MatchGroup p body -> Origin XMatchGroup :: XXMatchGroup p body -> MatchGroup p body -- | Guarded Right-Hand Sides -- -- GRHSs are used both for pattern bindings and for Matches -- -- data GRHSs p body GRHSs :: XCGRHSs p body -> [LGRHS p body] -> LHsLocalBinds p -> GRHSs p body [grhssExt] :: GRHSs p body -> XCGRHSs p body -- | Guarded RHSs [grhssGRHSs] :: GRHSs p body -> [LGRHS p body] -- | The where clause [grhssLocalBinds] :: GRHSs p body -> LHsLocalBinds p XGRHSs :: XXGRHSs p body -> GRHSs p body -- | Syntax Expression -- -- SyntaxExpr is like PostTcExpr, but it's filled in a little -- earlier, by the renamer. It's used for rebindable syntax. -- -- E.g. (>>=) is filled in before the renamer by the -- appropriate Name for (>>=), and then -- instantiated by the type checker with its type args etc -- -- This should desugar to -- --
--   syn_res_wrap $ syn_expr (syn_arg_wraps[0] arg0)
--                           (syn_arg_wraps[1] arg1) ...
--   
-- -- where the actual arguments come from elsewhere in the AST. This could -- be defined using GhcPass p and such, but it's harder to get -- it all to work out that way. (noSyntaxExpr is hard to write, -- for example.) data SyntaxExpr p SyntaxExpr :: HsExpr p -> [HsWrapper] -> HsWrapper -> SyntaxExpr p [syn_expr] :: SyntaxExpr p -> HsExpr p [syn_arg_wraps] :: SyntaxExpr p -> [HsWrapper] [syn_res_wrap] :: SyntaxExpr p -> HsWrapper -- | Located Haskell Expression type LHsExpr p = Located HsExpr p pprImpExp :: (HasOccName name, OutputableBndr name) => name -> SDoc replaceLWrappedName :: LIEWrappedName name1 -> name2 -> LIEWrappedName name2 replaceWrappedName :: IEWrappedName name1 -> name2 -> IEWrappedName name2 ieLWrappedName :: LIEWrappedName name -> Located name lieWrappedName :: LIEWrappedName name -> name ieWrappedName :: IEWrappedName name -> name ieNames :: forall (p :: Pass). IE (GhcPass p) -> [IdP (GhcPass p)] ieName :: forall (p :: Pass). IE (GhcPass p) -> IdP (GhcPass p) simpleImportDecl :: forall (p :: Pass). ModuleName -> ImportDecl (GhcPass p) -- | Convenience function to answer the question if an import decl. is -- qualified. isImportDeclQualified :: ImportDeclQualifiedStyle -> Bool -- | Given two possible located qualified tokens, compute a style -- (in a conforming Haskell program only one of the two can be not -- Nothing). This is called from y. importDeclQualifiedStyle :: Maybe (Located a) -> Maybe (Located a) -> ImportDeclQualifiedStyle -- | Located Import Declaration type LImportDecl pass = Located ImportDecl pass -- | If/how an import is qualified. data ImportDeclQualifiedStyle -- | qualified appears in prepositive position. QualifiedPre :: ImportDeclQualifiedStyle -- | qualified appears in postpositive position. QualifiedPost :: ImportDeclQualifiedStyle -- | Not qualified. NotQualified :: ImportDeclQualifiedStyle -- | Import Declaration -- -- A single Haskell import declaration. data ImportDecl pass ImportDecl :: XCImportDecl pass -> SourceText -> Located ModuleName -> Maybe StringLiteral -> Bool -> Bool -> ImportDeclQualifiedStyle -> Bool -> Maybe (Located ModuleName) -> Maybe (Bool, Located [LIE pass]) -> ImportDecl pass [ideclExt] :: ImportDecl pass -> XCImportDecl pass [ideclSourceSrc] :: ImportDecl pass -> SourceText -- | Module name. [ideclName] :: ImportDecl pass -> Located ModuleName -- | Package qualifier. [ideclPkgQual] :: ImportDecl pass -> Maybe StringLiteral -- | True = {-# SOURCE #-} import [ideclSource] :: ImportDecl pass -> Bool -- | True => safe import [ideclSafe] :: ImportDecl pass -> Bool -- | If/how the import is qualified. [ideclQualified] :: ImportDecl pass -> ImportDeclQualifiedStyle -- | True => implicit import (of Prelude) [ideclImplicit] :: ImportDecl pass -> Bool -- | as Module [ideclAs] :: ImportDecl pass -> Maybe (Located ModuleName) -- | (True => hiding, names) [ideclHiding] :: ImportDecl pass -> Maybe (Bool, Located [LIE pass]) -- | AnnKeywordIds -- -- XImportDecl :: XXImportDecl pass -> ImportDecl pass -- | A name in an import or export specification which may have adornments. -- Used primarily for accurate pretty printing of ParsedSource, and API -- Annotation placement. data IEWrappedName name -- | no extra IEName :: Located name -> IEWrappedName name -- | pattern X IEPattern :: Located name -> IEWrappedName name -- | type (:+:) IEType :: Located name -> IEWrappedName name -- | Located name with possible adornment - AnnKeywordIds : -- AnnType, AnnPattern type LIEWrappedName name = Located IEWrappedName name -- | Located Import or Export type LIE pass = Located IE pass -- | Imported or exported entity. data IE pass -- | Imported or Exported Variable IEVar :: XIEVar pass -> LIEWrappedName (IdP pass) -> IE pass -- | Imported or exported Thing with Absent list -- -- The thing is a Class/Type (can't tell) - AnnKeywordIds : -- AnnPattern, AnnType,AnnVal IEThingAbs :: XIEThingAbs pass -> LIEWrappedName (IdP pass) -> IE pass -- | Imported or exported Thing with All imported or exported -- -- The thing is a ClassType and the All refers to -- methodsconstructors -- -- IEThingAll :: XIEThingAll pass -> LIEWrappedName (IdP pass) -> IE pass -- | Imported or exported Thing With given imported or exported -- -- The thing is a Class/Type and the imported or exported things are -- methods/constructors and record fields; see Note [IEThingWith] - -- AnnKeywordIds : AnnOpen, AnnClose, -- AnnComma, AnnType IEThingWith :: XIEThingWith pass -> LIEWrappedName (IdP pass) -> IEWildcard -> [LIEWrappedName (IdP pass)] -> [Located (FieldLbl (IdP pass))] -> IE pass -- | Imported or exported module contents -- -- (Export Only) -- -- IEModuleContents :: XIEModuleContents pass -> Located ModuleName -> IE pass -- | Doc section heading IEGroup :: XIEGroup pass -> Int -> HsDocString -> IE pass -- | Some documentation IEDoc :: XIEDoc pass -> HsDocString -> IE pass -- | Reference to named doc IEDocNamed :: XIEDocNamed pass -> String -> IE pass XIE :: XXIE pass -> IE pass -- | Imported or Exported Wildcard data IEWildcard NoIEWildcard :: IEWildcard IEWildcard :: Int -> IEWildcard -- | Pattern -- -- data Pat p -- | Wildcard Pattern The sole reason for a type on a WildPat is to support -- hsPatType :: Pat Id -> Type WildPat :: XWildPat p -> Pat p -- | Variable Pattern VarPat :: XVarPat p -> Located (IdP p) -> Pat p -- | Lazy Pattern ^ - AnnKeywordId : AnnTilde LazyPat :: XLazyPat p -> LPat p -> Pat p -- | As pattern ^ - AnnKeywordId : AnnAt AsPat :: XAsPat p -> Located (IdP p) -> LPat p -> Pat p -- | Parenthesised pattern See Note [Parens in HsSyn] in GHC.Hs.Expr ^ - -- AnnKeywordId : AnnOpen '(', AnnClose -- ')' ParPat :: XParPat p -> LPat p -> Pat p -- | Bang pattern ^ - AnnKeywordId : AnnBang BangPat :: XBangPat p -> LPat p -> Pat p -- | Syntactic List -- -- ListPat :: XListPat p -> [LPat p] -> Pat p -- | Tuple sub-patterns -- -- TuplePat :: XTuplePat p -> [LPat p] -> Boxity -> Pat p -- | Anonymous sum pattern -- -- SumPat :: XSumPat p -> LPat p -> ConTag -> Arity -> Pat p -- | Constructor Pattern In ConPatIn :: Located (IdP p) -> HsConPatDetails p -> Pat p -- | Constructor Pattern Out ConPatOut :: Located ConLike -> [Type] -> [TyVar] -> [EvVar] -> TcEvBinds -> HsConPatDetails p -> HsWrapper -> Pat p [pat_con] :: Pat p -> Located ConLike [pat_arg_tys] :: Pat p -> [Type] [pat_tvs] :: Pat p -> [TyVar] [pat_dicts] :: Pat p -> [EvVar] [pat_binds] :: Pat p -> TcEvBinds [pat_args] :: Pat p -> HsConPatDetails p [pat_wrap] :: Pat p -> HsWrapper -- | View Pattern ViewPat :: XViewPat p -> LHsExpr p -> LPat p -> Pat p -- | Splice Pattern (Includes quasi-quotes) SplicePat :: XSplicePat p -> HsSplice p -> Pat p -- | Literal Pattern Used for *non-overloaded* literal patterns: Int, Int, -- Char, String, etc. LitPat :: XLitPat p -> HsLit p -> Pat p -- | Natural Pattern -- -- NPat :: XNPat p -> Located (HsOverLit p) -> Maybe (SyntaxExpr p) -> SyntaxExpr p -> Pat p -- | n+k pattern NPlusKPat :: XNPlusKPat p -> Located (IdP p) -> Located (HsOverLit p) -> HsOverLit p -> SyntaxExpr p -> SyntaxExpr p -> Pat p -- | Pattern with a type signature SigPat :: XSigPat p -> LPat p -> LHsSigWcType (NoGhcTc p) -> Pat p -- | Coercion Pattern CoPat :: XCoPat p -> HsWrapper -> Pat p -> Type -> Pat p -- | Trees that Grow extension point for new constructors XPat :: XXPat p -> Pat p type LPat p = XRec p Pat -- | Eliminate a NoExtCon. Much like absurd. noExtCon :: NoExtCon -> a -- | Used when constructing a term with an unused extension point. noExtField :: NoExtField -- | A placeholder type for TTG extension points that are not currently -- unused to represent any particular value. -- -- This should not be confused with NoExtCon, which are found in -- unused extension constructors and therefore should never be -- inhabited. In contrast, NoExtField is used in extension -- points (e.g., as the field of some constructor), so it must -- have an inhabitant to construct AST passes that manipulate fields with -- that extension point as their type. data NoExtField NoExtField :: NoExtField -- | Used in TTG extension constructors that have yet to be extended with -- anything. If an extension constructor has NoExtCon as its -- field, it is not intended to ever be constructed anywhere, and any -- function that consumes the extension constructor can eliminate it by -- way of noExtCon. -- -- This should not be confused with NoExtField, which are found in -- unused extension points (not constructors) and therefore -- can be inhabited. data NoExtCon -- | Used as a data type index for the hsSyn AST data GhcPass (c :: Pass) data Pass Parsed :: Pass Renamed :: Pass Typechecked :: Pass type GhcPs = GhcPass 'Parsed type GhcRn = GhcPass 'Renamed type GhcTc = GhcPass 'Typechecked type GhcTcId = GhcTc -- | GHC's L prefixed variants wrap their vanilla variant in this type -- family, to add SrcLoc info via Located. Other passes -- than GhcPass not interested in location information can define -- this instance as f p. type family XRec p (f :: Type -> Type) = (r :: Type) | r -> p f -- | Maps the "normal" id type for a given pass type family IdP p type LIdP p = Located IdP p -- | Marks that a field uses the GhcRn variant even when the pass parameter -- is GhcTc. Useful for storing HsTypes in GHC.Hs.Exprs, say, because -- HsType GhcTc should never occur. type family NoGhcTc p type family NoGhcTcPass (p :: Pass) :: Pass type family XHsValBinds x x' type family XHsIPBinds x x' type family XEmptyLocalBinds x x' type family XXHsLocalBindsLR x x' type ForallXHsLocalBindsLR (c :: Type -> Constraint) x x' = (c XHsValBinds x x', c XHsIPBinds x x', c XEmptyLocalBinds x x', c XXHsLocalBindsLR x x') type family XValBinds x x' type family XXValBindsLR x x' type ForallXValBindsLR (c :: Type -> Constraint) x x' = (c XValBinds x x', c XXValBindsLR x x') type family XFunBind x x' type family XPatBind x x' type family XVarBind x x' type family XAbsBinds x x' type family XPatSynBind x x' type family XXHsBindsLR x x' type ForallXHsBindsLR (c :: Type -> Constraint) x x' = (c XFunBind x x', c XPatBind x x', c XVarBind x x', c XAbsBinds x x', c XPatSynBind x x', c XXHsBindsLR x x') type family XABE x type family XXABExport x type ForallXABExport (c :: Type -> Constraint) x = (c XABE x, c XXABExport x) type family XPSB x x' type family XXPatSynBind x x' type ForallXPatSynBind (c :: Type -> Constraint) x x' = (c XPSB x x', c XXPatSynBind x x') type family XIPBinds x type family XXHsIPBinds x type ForallXHsIPBinds (c :: Type -> Constraint) x = (c XIPBinds x, c XXHsIPBinds x) type family XCIPBind x type family XXIPBind x type ForallXIPBind (c :: Type -> Constraint) x = (c XCIPBind x, c XXIPBind x) type family XTypeSig x type family XPatSynSig x type family XClassOpSig x type family XIdSig x type family XFixSig x type family XInlineSig x type family XSpecSig x type family XSpecInstSig x type family XMinimalSig x type family XSCCFunSig x type family XCompleteMatchSig x type family XXSig x type ForallXSig (c :: Type -> Constraint) x = (c XTypeSig x, c XPatSynSig x, c XClassOpSig x, c XIdSig x, c XFixSig x, c XInlineSig x, c XSpecSig x, c XSpecInstSig x, c XMinimalSig x, c XSCCFunSig x, c XCompleteMatchSig x, c XXSig x) type family XFixitySig x type family XXFixitySig x type ForallXFixitySig (c :: Type -> Constraint) x = (c XFixitySig x, c XXFixitySig x) type family XStandaloneKindSig x type family XXStandaloneKindSig x type family XTyClD x type family XInstD x type family XDerivD x type family XValD x type family XSigD x type family XKindSigD x type family XDefD x type family XForD x type family XWarningD x type family XAnnD x type family XRuleD x type family XSpliceD x type family XDocD x type family XRoleAnnotD x type family XXHsDecl x type ForallXHsDecl (c :: Type -> Constraint) x = (c XTyClD x, c XInstD x, c XDerivD x, c XValD x, c XSigD x, c XKindSigD x, c XDefD x, c XForD x, c XWarningD x, c XAnnD x, c XRuleD x, c XSpliceD x, c XDocD x, c XRoleAnnotD x, c XXHsDecl x) type family XCHsGroup x type family XXHsGroup x type ForallXHsGroup (c :: Type -> Constraint) x = (c XCHsGroup x, c XXHsGroup x) type family XSpliceDecl x type family XXSpliceDecl x type ForallXSpliceDecl (c :: Type -> Constraint) x = (c XSpliceDecl x, c XXSpliceDecl x) type family XFamDecl x type family XSynDecl x type family XDataDecl x type family XClassDecl x type family XXTyClDecl x type ForallXTyClDecl (c :: Type -> Constraint) x = (c XFamDecl x, c XSynDecl x, c XDataDecl x, c XClassDecl x, c XXTyClDecl x) type family XCTyClGroup x type family XXTyClGroup x type ForallXTyClGroup (c :: Type -> Constraint) x = (c XCTyClGroup x, c XXTyClGroup x) type family XNoSig x type family XCKindSig x type family XTyVarSig x type family XXFamilyResultSig x type ForallXFamilyResultSig (c :: Type -> Constraint) x = (c XNoSig x, c XCKindSig x, c XTyVarSig x, c XXFamilyResultSig x) type family XCFamilyDecl x type family XXFamilyDecl x type ForallXFamilyDecl (c :: Type -> Constraint) x = (c XCFamilyDecl x, c XXFamilyDecl x) type family XCHsDataDefn x type family XXHsDataDefn x type ForallXHsDataDefn (c :: Type -> Constraint) x = (c XCHsDataDefn x, c XXHsDataDefn x) type family XCHsDerivingClause x type family XXHsDerivingClause x type ForallXHsDerivingClause (c :: Type -> Constraint) x = (c XCHsDerivingClause x, c XXHsDerivingClause x) type family XConDeclGADT x type family XConDeclH98 x type family XXConDecl x type ForallXConDecl (c :: Type -> Constraint) x = (c XConDeclGADT x, c XConDeclH98 x, c XXConDecl x) type family XCFamEqn x r type family XXFamEqn x r type ForallXFamEqn (c :: Type -> Constraint) x r = (c XCFamEqn x r, c XXFamEqn x r) type family XCClsInstDecl x type family XXClsInstDecl x type ForallXClsInstDecl (c :: Type -> Constraint) x = (c XCClsInstDecl x, c XXClsInstDecl x) type family XClsInstD x type family XDataFamInstD x type family XTyFamInstD x type family XXInstDecl x type ForallXInstDecl (c :: Type -> Constraint) x = (c XClsInstD x, c XDataFamInstD x, c XTyFamInstD x, c XXInstDecl x) type family XCDerivDecl x type family XXDerivDecl x type ForallXDerivDecl (c :: Type -> Constraint) x = (c XCDerivDecl x, c XXDerivDecl x) type family XViaStrategy x type family XCDefaultDecl x type family XXDefaultDecl x type ForallXDefaultDecl (c :: Type -> Constraint) x = (c XCDefaultDecl x, c XXDefaultDecl x) type family XForeignImport x type family XForeignExport x type family XXForeignDecl x type ForallXForeignDecl (c :: Type -> Constraint) x = (c XForeignImport x, c XForeignExport x, c XXForeignDecl x) type family XCRuleDecls x type family XXRuleDecls x type ForallXRuleDecls (c :: Type -> Constraint) x = (c XCRuleDecls x, c XXRuleDecls x) type family XHsRule x type family XXRuleDecl x type ForallXRuleDecl (c :: Type -> Constraint) x = (c XHsRule x, c XXRuleDecl x) type family XCRuleBndr x type family XRuleBndrSig x type family XXRuleBndr x type ForallXRuleBndr (c :: Type -> Constraint) x = (c XCRuleBndr x, c XRuleBndrSig x, c XXRuleBndr x) type family XWarnings x type family XXWarnDecls x type ForallXWarnDecls (c :: Type -> Constraint) x = (c XWarnings x, c XXWarnDecls x) type family XWarning x type family XXWarnDecl x type ForallXWarnDecl (c :: Type -> Constraint) x = (c XWarning x, c XXWarnDecl x) type family XHsAnnotation x type family XXAnnDecl x type ForallXAnnDecl (c :: Type -> Constraint) x = (c XHsAnnotation x, c XXAnnDecl x) type family XCRoleAnnotDecl x type family XXRoleAnnotDecl x type ForallXRoleAnnotDecl (c :: Type -> Constraint) x = (c XCRoleAnnotDecl x, c XXRoleAnnotDecl x) type family XVar x type family XUnboundVar x type family XConLikeOut x type family XRecFld x type family XOverLabel x type family XIPVar x type family XOverLitE x type family XLitE x type family XLam x type family XLamCase x type family XApp x type family XAppTypeE x type family XOpApp x type family XNegApp x type family XPar x type family XSectionL x type family XSectionR x type family XExplicitTuple x type family XExplicitSum x type family XCase x type family XIf x type family XMultiIf x type family XLet x type family XDo x type family XExplicitList x type family XRecordCon x type family XRecordUpd x type family XExprWithTySig x type family XArithSeq x type family XSCC x type family XCoreAnn x type family XBracket x type family XRnBracketOut x type family XTcBracketOut x type family XSpliceE x type family XProc x type family XStatic x type family XTick x type family XBinTick x type family XTickPragma x type family XWrap x type family XXExpr x type ForallXExpr (c :: Type -> Constraint) x = (c XVar x, c XUnboundVar x, c XConLikeOut x, c XRecFld x, c XOverLabel x, c XIPVar x, c XOverLitE x, c XLitE x, c XLam x, c XLamCase x, c XApp x, c XAppTypeE x, c XOpApp x, c XNegApp x, c XPar x, c XSectionL x, c XSectionR x, c XExplicitTuple x, c XExplicitSum x, c XCase x, c XIf x, c XMultiIf x, c XLet x, c XDo x, c XExplicitList x, c XRecordCon x, c XRecordUpd x, c XExprWithTySig x, c XArithSeq x, c XSCC x, c XCoreAnn x, c XBracket x, c XRnBracketOut x, c XTcBracketOut x, c XSpliceE x, c XProc x, c XStatic x, c XTick x, c XBinTick x, c XTickPragma x, c XWrap x, c XXExpr x) type family XUnambiguous x type family XAmbiguous x type family XXAmbiguousFieldOcc x type ForallXAmbiguousFieldOcc (c :: Type -> Constraint) x = (c XUnambiguous x, c XAmbiguous x, c XXAmbiguousFieldOcc x) type family XPresent x type family XMissing x type family XXTupArg x type ForallXTupArg (c :: Type -> Constraint) x = (c XPresent x, c XMissing x, c XXTupArg x) type family XTypedSplice x type family XUntypedSplice x type family XQuasiQuote x type family XSpliced x type family XXSplice x type ForallXSplice (c :: Type -> Constraint) x = (c XTypedSplice x, c XUntypedSplice x, c XQuasiQuote x, c XSpliced x, c XXSplice x) type family XExpBr x type family XPatBr x type family XDecBrL x type family XDecBrG x type family XTypBr x type family XVarBr x type family XTExpBr x type family XXBracket x type ForallXBracket (c :: Type -> Constraint) x = (c XExpBr x, c XPatBr x, c XDecBrL x, c XDecBrG x, c XTypBr x, c XVarBr x, c XTExpBr x, c XXBracket x) type family XCmdTop x type family XXCmdTop x type ForallXCmdTop (c :: Type -> Constraint) x = (c XCmdTop x, c XXCmdTop x) type family XMG x b type family XXMatchGroup x b type ForallXMatchGroup (c :: Type -> Constraint) x b = (c XMG x b, c XXMatchGroup x b) type family XCMatch x b type family XXMatch x b type ForallXMatch (c :: Type -> Constraint) x b = (c XCMatch x b, c XXMatch x b) type family XCGRHSs x b type family XXGRHSs x b type ForallXGRHSs (c :: Type -> Constraint) x b = (c XCGRHSs x b, c XXGRHSs x b) type family XCGRHS x b type family XXGRHS x b type ForallXGRHS (c :: Type -> Constraint) x b = (c XCGRHS x b, c XXGRHS x b) type family XLastStmt x x' b type family XBindStmt x x' b type family XApplicativeStmt x x' b type family XBodyStmt x x' b type family XLetStmt x x' b type family XParStmt x x' b type family XTransStmt x x' b type family XRecStmt x x' b type family XXStmtLR x x' b type ForallXStmtLR (c :: Type -> Constraint) x x' b = (c XLastStmt x x' b, c XBindStmt x x' b, c XApplicativeStmt x x' b, c XBodyStmt x x' b, c XLetStmt x x' b, c XParStmt x x' b, c XTransStmt x x' b, c XRecStmt x x' b, c XXStmtLR x x' b) type family XCmdArrApp x type family XCmdArrForm x type family XCmdApp x type family XCmdLam x type family XCmdPar x type family XCmdCase x type family XCmdIf x type family XCmdLet x type family XCmdDo x type family XCmdWrap x type family XXCmd x type ForallXCmd (c :: Type -> Constraint) x = (c XCmdArrApp x, c XCmdArrForm x, c XCmdApp x, c XCmdLam x, c XCmdPar x, c XCmdCase x, c XCmdIf x, c XCmdLet x, c XCmdDo x, c XCmdWrap x, c XXCmd x) type family XParStmtBlock x x' type family XXParStmtBlock x x' type ForallXParStmtBlock (c :: Type -> Constraint) x x' = (c XParStmtBlock x x', c XXParStmtBlock x x') type family XApplicativeArgOne x type family XApplicativeArgMany x type family XXApplicativeArg x type ForallXApplicativeArg (c :: Type -> Constraint) x = (c XApplicativeArgOne x, c XApplicativeArgMany x, c XXApplicativeArg x) type family XHsChar x type family XHsCharPrim x type family XHsString x type family XHsStringPrim x type family XHsInt x type family XHsIntPrim x type family XHsWordPrim x type family XHsInt64Prim x type family XHsWord64Prim x type family XHsInteger x type family XHsRat x type family XHsFloatPrim x type family XHsDoublePrim x type family XXLit x -- | Helper to apply a constraint to all extension points. It has one entry -- per extension point type family. type ForallXHsLit (c :: Type -> Constraint) x = (c XHsChar x, c XHsCharPrim x, c XHsDoublePrim x, c XHsFloatPrim x, c XHsInt x, c XHsInt64Prim x, c XHsIntPrim x, c XHsInteger x, c XHsRat x, c XHsString x, c XHsStringPrim x, c XHsWord64Prim x, c XHsWordPrim x, c XXLit x) type family XOverLit x type family XXOverLit x type ForallXOverLit (c :: Type -> Constraint) x = (c XOverLit x, c XXOverLit x) type family XWildPat x type family XVarPat x type family XLazyPat x type family XAsPat x type family XParPat x type family XBangPat x type family XListPat x type family XTuplePat x type family XSumPat x type family XConPat x type family XViewPat x type family XSplicePat x type family XLitPat x type family XNPat x type family XNPlusKPat x type family XSigPat x type family XCoPat x type family XXPat x type ForallXPat (c :: Type -> Constraint) x = (c XWildPat x, c XVarPat x, c XLazyPat x, c XAsPat x, c XParPat x, c XBangPat x, c XListPat x, c XTuplePat x, c XSumPat x, c XViewPat x, c XSplicePat x, c XLitPat x, c XNPat x, c XNPlusKPat x, c XSigPat x, c XCoPat x, c XXPat x) type family XHsQTvs x type family XXLHsQTyVars x type ForallXLHsQTyVars (c :: Type -> Constraint) x = (c XHsQTvs x, c XXLHsQTyVars x) type family XHsIB x b type family XXHsImplicitBndrs x b type ForallXHsImplicitBndrs (c :: Type -> Constraint) x b = (c XHsIB x b, c XXHsImplicitBndrs x b) type family XHsWC x b type family XXHsWildCardBndrs x b type ForallXHsWildCardBndrs (c :: Type -> Constraint) x b = (c XHsWC x b, c XXHsWildCardBndrs x b) type family XForAllTy x type family XQualTy x type family XTyVar x type family XAppTy x type family XAppKindTy x type family XFunTy x type family XListTy x type family XTupleTy x type family XSumTy x type family XOpTy x type family XParTy x type family XIParamTy x type family XStarTy x type family XKindSig x type family XSpliceTy x type family XDocTy x type family XBangTy x type family XRecTy x type family XExplicitListTy x type family XExplicitTupleTy x type family XTyLit x type family XWildCardTy x type family XXType x -- | Helper to apply a constraint to all extension points. It has one entry -- per extension point type family. type ForallXType (c :: Type -> Constraint) x = (c XForAllTy x, c XQualTy x, c XTyVar x, c XAppTy x, c XAppKindTy x, c XFunTy x, c XListTy x, c XTupleTy x, c XSumTy x, c XOpTy x, c XParTy x, c XIParamTy x, c XStarTy x, c XKindSig x, c XSpliceTy x, c XDocTy x, c XBangTy x, c XRecTy x, c XExplicitListTy x, c XExplicitTupleTy x, c XTyLit x, c XWildCardTy x, c XXType x) type family XUserTyVar x type family XKindedTyVar x type family XXTyVarBndr x type ForallXTyVarBndr (c :: Type -> Constraint) x = (c XUserTyVar x, c XKindedTyVar x, c XXTyVarBndr x) type family XConDeclField x type family XXConDeclField x type ForallXConDeclField (c :: Type -> Constraint) x = (c XConDeclField x, c XXConDeclField x) type family XCFieldOcc x type family XXFieldOcc x type ForallXFieldOcc (c :: Type -> Constraint) x = (c XCFieldOcc x, c XXFieldOcc x) type family XCImportDecl x type family XXImportDecl x type ForallXImportDecl (c :: Type -> Constraint) x = (c XCImportDecl x, c XXImportDecl x) type family XIEVar x type family XIEThingAbs x type family XIEThingAll x type family XIEThingWith x type family XIEModuleContents x type family XIEGroup x type family XIEDoc x type family XIEDocNamed x type family XXIE x type ForallXIE (c :: Type -> Constraint) x = (c XIEVar x, c XIEThingAbs x, c XIEThingAll x, c XIEThingWith x, c XIEModuleContents x, c XIEGroup x, c XIEDoc x, c XIEDocNamed x, c XXIE x) -- | Conversion of annotations from one type index to another. This is -- required where the AST is converted from one pass to another, and the -- extension values need to be brought along if possible. So for example -- a SourceText is converted via id, but needs a type -- signature to keep the type checker happy. class Convertable a b | a -> b convert :: Convertable a b => a -> b -- | A constraint capturing all the extension points that can be converted -- via instance Convertable a a type ConvertIdX a b = (XHsDoublePrim a ~ XHsDoublePrim b, XHsFloatPrim a ~ XHsFloatPrim b, XHsRat a ~ XHsRat b, XHsInteger a ~ XHsInteger b, XHsWord64Prim a ~ XHsWord64Prim b, XHsInt64Prim a ~ XHsInt64Prim b, XHsWordPrim a ~ XHsWordPrim b, XHsIntPrim a ~ XHsIntPrim b, XHsInt a ~ XHsInt b, XHsStringPrim a ~ XHsStringPrim b, XHsString a ~ XHsString b, XHsCharPrim a ~ XHsCharPrim b, XHsChar a ~ XHsChar b, XXLit a ~ XXLit b) -- | Provide a summary constraint that gives all am Outputable constraint -- to extension points needing one type OutputableX p = (Outputable XIPBinds p, Outputable XViaStrategy p, Outputable XViaStrategy GhcRn) -- | Constraint type to bundle up the requirement for OutputableBndr -- on both the p and the NameOrRdrName type for it type OutputableBndrId (pass :: Pass) = (OutputableBndr NameOrRdrName IdP GhcPass pass, OutputableBndr IdP GhcPass pass, OutputableBndr NameOrRdrName IdP NoGhcTc GhcPass pass, OutputableBndr IdP NoGhcTc GhcPass pass, NoGhcTc GhcPass pass ~ NoGhcTc NoGhcTc GhcPass pass, OutputableX GhcPass pass, OutputableX NoGhcTc GhcPass pass) placeHolderNamesTc :: NameSet -- | Follow the id, but never beyond Name. This is used in a -- HsMatchContext, for printing messages related to a -- Match type family NameOrRdrName id -- | isExportedIdVar means "don't throw this away" isExportedId :: Var -> Bool -- | mustHaveLocalBinding returns True of Ids and -- TyVars that must have a binding in this module. The converse is -- not quite right: there are some global Ids that must have -- bindings, such as record selectors. But that doesn't matter, because -- it's only used for assertions mustHaveLocalBinding :: Var -> Bool isGlobalId :: Var -> Bool -- | isLocalVar returns True for type variables as well as -- local Ids These are the variables that we need to pay attention -- to when finding free variables, or doing dependency analysis. isLocalVar :: Var -> Bool isLocalId :: Var -> Bool -- | Is this a term variable (Id) that is not a coercion -- variable? Satisfies isId v ==> isCoVar v == not -- (isNonCoVarId v). isNonCoVarId :: Var -> Bool -- | Is this a coercion variable? Satisfies isId v ==> -- isCoVar v == not (isNonCoVarId v). isCoVar :: Var -> Bool -- | Is this a value-level (i.e., computationally relevant) -- Identifier? Satisfies isId = not . isTyVar. isId :: Var -> Bool isTyCoVar :: Var -> Bool isTcTyVar :: Var -> Bool -- | Is this a type-level (i.e., computationally irrelevant, thus erasable) -- variable? Satisfies isTyVar = not . isId. isTyVar :: Var -> Bool -- | We can only do this to LocalIds setIdNotExported :: Id -> Id -- | Exports the given local Id. Can also be called on global -- Ids, such as data constructors and class operations, which are -- born as global Ids and automatically exported setIdExported :: Id -> Id -- | If it's a local, make it global globaliseId :: Id -> Id setIdDetails :: Id -> IdDetails -> Id lazySetIdInfo :: Id -> IdInfo -> Var -- | Exported Vars will not be removed as dead code mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id mkCoVar :: Name -> Type -> CoVar mkLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id idDetails :: Id -> IdDetails idInfo :: HasDebugCallStack => Id -> IdInfo setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar tcTyVarDetails :: TyVar -> TcTyVarDetails mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar mkTyVar :: Name -> Kind -> TyVar updateTyVarKindM :: Monad m => (Kind -> m Kind) -> TyVar -> m TyVar updateTyVarKind :: (Kind -> Kind) -> TyVar -> TyVar setTyVarKind :: TyVar -> Kind -> TyVar setTyVarName :: TyVar -> Name -> TyVar setTyVarUnique :: TyVar -> Unique -> TyVar tyVarKind :: TyVar -> Kind tyVarName :: TyVar -> Name isTyVarBinder :: TyCoVarBinder -> Bool -- | Make many named binders Input vars should be type variables mkTyVarBinders :: ArgFlag -> [TyVar] -> [TyVarBinder] -- | Make many named binders mkTyCoVarBinders :: ArgFlag -> [TyCoVar] -> [TyCoVarBinder] -- | Make a named binder var should be a type variable mkTyVarBinder :: ArgFlag -> TyVar -> TyVarBinder -- | Make a named binder mkTyCoVarBinder :: ArgFlag -> TyCoVar -> TyCoVarBinder binderType :: VarBndr TyCoVar argf -> Type binderArgFlag :: VarBndr tv argf -> argf binderVars :: [VarBndr tv argf] -> [tv] binderVar :: VarBndr tv argf -> tv -- | Convert an ArgFlag to its corresponding ForallVisFlag. argToForallVisFlag :: ArgFlag -> ForallVisFlag -- | Do these denote the same level of visibility? Required -- arguments are visible, others are not. So this function equates -- Specified and Inferred. Used for printing. sameVis :: ArgFlag -> ArgFlag -> Bool -- | Does this ArgFlag classify an argument that is not written in -- Haskell? isInvisibleArgFlag :: ArgFlag -> Bool -- | Does this ArgFlag classify an argument that is written in -- Haskell? isVisibleArgFlag :: ArgFlag -> Bool updateVarTypeM :: Monad m => (Type -> m Type) -> Id -> m Id updateVarType :: (Type -> Type) -> Id -> Id setVarType :: Id -> Type -> Id setVarName :: Var -> Name -> Var setVarUnique :: Var -> Unique -> Var varUnique :: Var -> Unique -- | Compare Vars by their Uniques. This is what Ord Var does, provided -- here to make it explicit at the call-site that it can introduce -- non-determinism. See Note [Unique Determinism] nonDetCmpVar :: Var -> Var -> Ordering -- | Identifier type Id = Var -- | Coercion Variable type CoVar = Id type NcId = Id -- | Type or kind Variable type TyVar = Var -- | Type or Kind Variable type TKVar = Var -- | Type variable that might be a metavariable type TcTyVar = Var -- | Type Variable type TypeVar = Var -- | Kind Variable type KindVar = Var -- | Evidence Identifier type EvId = Id -- | Evidence Variable type EvVar = EvId -- | Dictionary Function Identifier type DFunId = Id -- | Dictionary Identifier type DictId = EvId -- | Implicit parameter Identifier type IpId = EvId -- | Equality Variable type EqVar = EvId type JoinId = Id -- | Type or Coercion Variable type TyCoVar = Id type InVar = Var type InTyVar = TyVar type InCoVar = CoVar type InId = Id type OutVar = Var type OutTyVar = TyVar type OutCoVar = CoVar type OutId = Id -- | Is a forall invisible (e.g., forall a b. {...}, with -- a dot) or visible (e.g., forall a b -> {...}, with an -- arrow)? data ForallVisFlag -- | A visible forall (with an arrow) ForallVis :: ForallVisFlag -- | An invisible forall (with a dot) ForallInvis :: ForallVisFlag data VarBndr var argf Bndr :: var -> argf -> VarBndr var argf -- | Variable Binder -- -- A TyCoVarBinder is the binder of a ForAllTy It's convenient to -- define this synonym here rather its natural home in TyCoRep, because -- it's used in DataCon.hs-boot -- -- A TyVarBinder is a binder with only TyVar type TyCoVarBinder = VarBndr TyCoVar ArgFlag type TyVarBinder = VarBndr TyVar ArgFlag data Token -- | Convert a normal annotation into its unicode equivalent one unicodeAnn :: AnnKeywordId -> AnnKeywordId -- | Retrieve the comments allocated to the current SrcSpan, and -- remove them from the annotations getAndRemoveAnnotationComments :: ApiAnns -> SrcSpan -> ([Located AnnotationComment], ApiAnns) -- | Retrieve the comments allocated to the current SrcSpan -- -- Note: A given SrcSpan may appear in multiple AST elements, -- beware of duplicates getAnnotationComments :: ApiAnns -> SrcSpan -> [Located AnnotationComment] -- | Retrieve a list of annotation SrcSpans based on the -- SrcSpan of the annotated AST element, and the known type of the -- annotation. The list is removed from the annotations. getAndRemoveAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> ([SrcSpan], ApiAnns) -- | Retrieve a list of annotation SrcSpans based on the -- SrcSpan of the annotated AST element, and the known type of the -- annotation. getAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> [SrcSpan] type ApiAnns = (Map ApiAnnKey [SrcSpan], Map SrcSpan [Located AnnotationComment]) -- | API Annotations exist so that tools can perform source to source -- conversions of Haskell code. They are used to keep track of the -- various syntactic keywords that are not captured in the existing AST. -- -- The annotations, together with original source comments are made -- available in the pm_annotations field of -- ParsedModule. Comments are only retained if -- Opt_KeepRawTokenStream is set in -- DynFlags before parsing. -- -- The wiki page describing this feature is -- https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations -- -- Note: in general the names of these are taken from the corresponding -- token, unless otherwise noted See note [Api annotations] above for -- details of the usage data AnnKeywordId AnnAnyclass :: AnnKeywordId AnnAs :: AnnKeywordId AnnAt :: AnnKeywordId -- | ! AnnBang :: AnnKeywordId -- | '`' AnnBackquote :: AnnKeywordId AnnBy :: AnnKeywordId -- | case or lambda case AnnCase :: AnnKeywordId AnnClass :: AnnKeywordId -- | '#)' or '#-}' etc AnnClose :: AnnKeywordId -- | '|)' AnnCloseB :: AnnKeywordId -- | '|)', unicode variant AnnCloseBU :: AnnKeywordId -- | '}' AnnCloseC :: AnnKeywordId -- | '|]' AnnCloseQ :: AnnKeywordId -- | '|]', unicode variant AnnCloseQU :: AnnKeywordId -- | ')' AnnCloseP :: AnnKeywordId -- | ']' AnnCloseS :: AnnKeywordId AnnColon :: AnnKeywordId -- | as a list separator AnnComma :: AnnKeywordId -- | in a RdrName for a tuple AnnCommaTuple :: AnnKeywordId -- | '=>' AnnDarrow :: AnnKeywordId -- | '=>', unicode variant AnnDarrowU :: AnnKeywordId AnnData :: AnnKeywordId -- | '::' AnnDcolon :: AnnKeywordId -- | '::', unicode variant AnnDcolonU :: AnnKeywordId AnnDefault :: AnnKeywordId AnnDeriving :: AnnKeywordId AnnDo :: AnnKeywordId -- | . AnnDot :: AnnKeywordId -- | '..' AnnDotdot :: AnnKeywordId AnnElse :: AnnKeywordId AnnEqual :: AnnKeywordId AnnExport :: AnnKeywordId AnnFamily :: AnnKeywordId AnnForall :: AnnKeywordId -- | Unicode variant AnnForallU :: AnnKeywordId AnnForeign :: AnnKeywordId -- | for function name in matches where there are multiple equations for -- the function. AnnFunId :: AnnKeywordId AnnGroup :: AnnKeywordId -- | for CType AnnHeader :: AnnKeywordId AnnHiding :: AnnKeywordId AnnIf :: AnnKeywordId AnnImport :: AnnKeywordId AnnIn :: AnnKeywordId -- | 'infix' or 'infixl' or 'infixr' AnnInfix :: AnnKeywordId AnnInstance :: AnnKeywordId AnnLam :: AnnKeywordId -- | '<-' AnnLarrow :: AnnKeywordId -- | '<-', unicode variant AnnLarrowU :: AnnKeywordId AnnLet :: AnnKeywordId AnnMdo :: AnnKeywordId -- | - AnnMinus :: AnnKeywordId AnnModule :: AnnKeywordId AnnNewtype :: AnnKeywordId -- | where a name loses its location in the AST, this carries it AnnName :: AnnKeywordId AnnOf :: AnnKeywordId -- | '(#' or '{-# LANGUAGE' etc AnnOpen :: AnnKeywordId -- | '(|' AnnOpenB :: AnnKeywordId -- | '(|', unicode variant AnnOpenBU :: AnnKeywordId -- | '{' AnnOpenC :: AnnKeywordId -- | '[e|' or '[e||' AnnOpenE :: AnnKeywordId -- | '[|' AnnOpenEQ :: AnnKeywordId -- | '[|', unicode variant AnnOpenEQU :: AnnKeywordId -- | '(' AnnOpenP :: AnnKeywordId -- | '$(' AnnOpenPE :: AnnKeywordId -- | '$$(' AnnOpenPTE :: AnnKeywordId -- | '[' AnnOpenS :: AnnKeywordId AnnPackageName :: AnnKeywordId AnnPattern :: AnnKeywordId AnnProc :: AnnKeywordId AnnQualified :: AnnKeywordId -- | -> AnnRarrow :: AnnKeywordId -- | ->, unicode variant AnnRarrowU :: AnnKeywordId AnnRec :: AnnKeywordId AnnRole :: AnnKeywordId AnnSafe :: AnnKeywordId -- | ';' AnnSemi :: AnnKeywordId -- | ''' AnnSimpleQuote :: AnnKeywordId AnnSignature :: AnnKeywordId -- | static AnnStatic :: AnnKeywordId AnnStock :: AnnKeywordId AnnThen :: AnnKeywordId -- | $ AnnThIdSplice :: AnnKeywordId -- | $$ AnnThIdTySplice :: AnnKeywordId -- | double ''' AnnThTyQuote :: AnnKeywordId -- | '~' AnnTilde :: AnnKeywordId AnnType :: AnnKeywordId -- | () for types AnnUnit :: AnnKeywordId AnnUsing :: AnnKeywordId -- | e.g. INTEGER AnnVal :: AnnKeywordId -- | String value, will need quotes when output AnnValStr :: AnnKeywordId -- | '|' AnnVbar :: AnnKeywordId -- | via AnnVia :: AnnKeywordId AnnWhere :: AnnKeywordId -- | -< Annlarrowtail :: AnnKeywordId -- | -<, unicode variant AnnlarrowtailU :: AnnKeywordId -- | -> Annrarrowtail :: AnnKeywordId -- | ->, unicode variant AnnrarrowtailU :: AnnKeywordId -- | -<< AnnLarrowtail :: AnnKeywordId -- | -<<, unicode variant AnnLarrowtailU :: AnnKeywordId -- | >>- AnnRarrowtail :: AnnKeywordId -- | >>-, unicode variant AnnRarrowtailU :: AnnKeywordId AnnEofPos :: AnnKeywordId data AnnotationComment -- | something beginning '-- |' AnnDocCommentNext :: String -> AnnotationComment -- | something beginning '-- ^' AnnDocCommentPrev :: String -> AnnotationComment -- | something beginning '-- $' AnnDocCommentNamed :: String -> AnnotationComment -- | a section heading AnnDocSection :: Int -> String -> AnnotationComment -- | doc options (prune, ignore-exports, etc) AnnDocOptions :: String -> AnnotationComment -- | comment starting by "--" AnnLineComment :: String -> AnnotationComment -- | comment in {- -} AnnBlockComment :: String -> AnnotationComment nilDataConKey :: Unique listTyConKey :: Unique -- | Display info about the treatment of * under NoStarIsType. -- -- With StarIsType, three properties of * hold: -- -- (a) it is not an infix operator (b) it is always in scope (c) it is a -- synonym for Data.Kind.Type -- -- However, the user might not know that he's working on a module with -- NoStarIsType and write code that still assumes (a), (b), and (c), -- which actually do not hold in that module. -- -- Violation of (a) shows up in the parser. For instance, in the -- following examples, we have * not applied to enough arguments: -- -- data A :: * data F :: * -> * -- -- Violation of (b) or (c) show up in the renamer and the typechecker -- respectively. For instance: -- -- type K = Either * Bool -- -- This will parse differently depending on whether StarIsType is -- enabled, but it will parse nonetheless. With NoStarIsType it is parsed -- as a type operator, thus we have ((*) Either Bool). Now there are two -- cases to consider: -- --
    --
  1. There is no definition of (*) in scope. In this case the renamer -- will fail to look it up. This is a violation of assumption (b).
  2. --
  3. There is a definition of the (*) type operator in scope (for -- example coming from GHC.TypeNats). In this case the user will get a -- kind mismatch error. This is a violation of assumption (c).
  4. --
-- -- The user might unknowingly be working on a module with NoStarIsType or -- use * as Type out of habit. So it is important to give a -- hint whenever an assumption about * is violated. Unfortunately, -- it is somewhat difficult to deal with (c), so we limit ourselves to -- (a) and (b). -- -- starInfo generates an appropriate hint to the user depending on -- the extensions enabled in the module and the name that triggered the -- error. That is, if we have NoStarIsType and the error is related to -- * or its Unicode variant, the resulting SDoc will contain a -- helpful suggestion. Otherwise it is empty. starInfo :: Bool -> RdrName -> SDoc -- | Print out one place where the name was define/imported (With -- -dppr-debug, print them all) pprNameProvenance :: GlobalRdrElt -> SDoc isExplicitItem :: ImpItemSpec -> Bool importSpecModule :: ImportSpec -> ModuleName importSpecLoc :: ImportSpec -> SrcSpan -- | Is in scope qualified with the given module? qualSpecOK :: ModuleName -> ImportSpec -> Bool -- | Is in scope unqualified? unQualSpecOK :: ImportSpec -> Bool bestImport :: [ImportSpec] -> ImportSpec shadowNames :: GlobalRdrEnv -> [Name] -> GlobalRdrEnv extendGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrElt -> GlobalRdrEnv -- | Apply a transformation function to the GREs for these OccNames transformGREs :: (GlobalRdrElt -> GlobalRdrElt) -> [OccName] -> GlobalRdrEnv -> GlobalRdrEnv mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv plusGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrEnv -> GlobalRdrEnv -- | Pick GREs that are in scope *both* qualified *and* unqualified Return -- each GRE that is, as a pair (qual_gre, unqual_gre) These two GREs are -- the original GRE with imports filtered to express how it is in scope -- qualified an unqualified respectively -- -- Used only for the 'module M' item in export list; see -- RnNames.exports_from_avail pickGREsModExp :: ModuleName -> [GlobalRdrElt] -> [(GlobalRdrElt, GlobalRdrElt)] -- | Takes a list of GREs which have the right OccName x Pick -- those GREs that are in scope * Qualified, as x if want_qual is -- Qual M _ * Unqualified, as x if want_unqual is Unqual _ -- -- Return each such GRE, with its ImportSpecs filtered, to reflect how it -- is in scope qualified or unqualified respectively. See Note [GRE -- filtering] pickGREs :: RdrName -> [GlobalRdrElt] -> [GlobalRdrElt] -- | Test if an unqualified version of this thing would be in scope unQualOK :: GlobalRdrElt -> Bool greLabel :: GlobalRdrElt -> Maybe FieldLabelString -- | Is this a record field defined with DuplicateRecordFields? (See Note -- [Parents for record fields]) isOverloadedRecFldGRE :: GlobalRdrElt -> Bool isRecFldGRE :: GlobalRdrElt -> Bool isLocalGRE :: GlobalRdrElt -> Bool getGRE_NameQualifier_maybes :: GlobalRdrEnv -> Name -> [Maybe [ModuleName]] -- | Look for precisely this Name in the environment, but with an -- OccName that might differ from that of the Name. See -- lookupGRE_FieldLabel and Note [Parents for record fields]. lookupGRE_Name_OccName :: GlobalRdrEnv -> Name -> OccName -> Maybe GlobalRdrElt -- | Look for a particular record field selector in the environment, where -- the selector name and field label may be different: the GlobalRdrEnv -- is keyed on the label. See Note [Parents for record fields] for why -- this happens. lookupGRE_FieldLabel :: GlobalRdrEnv -> FieldLabel -> Maybe GlobalRdrElt -- | Look for precisely this Name in the environment. This tests -- whether it is in scope, ignoring anything else that might be in scope -- with the same OccName. lookupGRE_Name :: GlobalRdrEnv -> Name -> Maybe GlobalRdrElt lookupGRE_RdrName :: RdrName -> GlobalRdrEnv -> [GlobalRdrElt] greOccName :: GlobalRdrElt -> OccName lookupGlobalRdrEnv :: GlobalRdrEnv -> OccName -> [GlobalRdrElt] pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc globalRdrEnvElts :: GlobalRdrEnv -> [GlobalRdrElt] emptyGlobalRdrEnv :: GlobalRdrEnv availFromGRE :: GlobalRdrElt -> AvailInfo -- | Takes a list of distinct GREs and folds them into AvailInfos. This is -- more efficient than mapping each individual GRE to an AvailInfo and -- the folding using plusAvail but needs the uniqueness -- assumption. gresToAvailInfo :: [GlobalRdrElt] -> [AvailInfo] greParent_maybe :: GlobalRdrElt -> Maybe Name greSrcSpan :: GlobalRdrElt -> SrcSpan greRdrNames :: GlobalRdrElt -> [RdrName] greQualModName :: GlobalRdrElt -> ModuleName gresFromAvail :: (Name -> Maybe ImportSpec) -> AvailInfo -> [GlobalRdrElt] localGREsFromAvail :: AvailInfo -> [GlobalRdrElt] -- | make a GlobalRdrEnv where all the elements point to the same -- Provenance (useful for "hiding" imports, or imports with no details). gresFromAvails :: Maybe ImportSpec -> [AvailInfo] -> [GlobalRdrElt] delLocalRdrEnvList :: LocalRdrEnv -> [OccName] -> LocalRdrEnv inLocalRdrEnvScope :: Name -> LocalRdrEnv -> Bool localRdrEnvElts :: LocalRdrEnv -> [Name] elemLocalRdrEnv :: RdrName -> LocalRdrEnv -> Bool lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name extendLocalRdrEnvList :: LocalRdrEnv -> [Name] -> LocalRdrEnv extendLocalRdrEnv :: LocalRdrEnv -> Name -> LocalRdrEnv emptyLocalRdrEnv :: LocalRdrEnv isExact_maybe :: RdrName -> Maybe Name isExact :: RdrName -> Bool isOrig_maybe :: RdrName -> Maybe (Module, OccName) isOrig :: RdrName -> Bool isQual_maybe :: RdrName -> Maybe (ModuleName, OccName) isQual :: RdrName -> Bool isUnqual :: RdrName -> Bool isSrcRdrName :: RdrName -> Bool isRdrTc :: RdrName -> Bool isRdrTyVar :: RdrName -> Bool isRdrDataCon :: RdrName -> Bool nameRdrName :: Name -> RdrName getRdrName :: NamedThing thing => thing -> RdrName -- | Make a qualified RdrName in the given namespace and where the -- ModuleName and the OccName are taken from the first and -- second elements of the tuple respectively mkQual :: NameSpace -> (FastString, FastString) -> RdrName mkVarUnqual :: FastString -> RdrName mkUnqual :: NameSpace -> FastString -> RdrName mkOrig :: Module -> OccName -> RdrName mkRdrQual :: ModuleName -> OccName -> RdrName mkRdrUnqual :: OccName -> RdrName demoteRdrName :: RdrName -> Maybe RdrName rdrNameSpace :: RdrName -> NameSpace rdrNameOcc :: RdrName -> OccName -- | Reader Name -- -- Do not use the data constructors of RdrName directly: prefer the -- family of functions that creates them, such as mkRdrUnqual -- -- -- --
--   `bar`
--   ( ~ )
--   
-- -- data RdrName -- | Unqualified name -- -- Used for ordinary, unqualified occurrences, e.g. x, -- y or Foo. Create such a RdrName with -- mkRdrUnqual Unqual :: OccName -> RdrName -- | Qualified name -- -- A qualified name written by the user in source code. The module -- isn't necessarily the module where the thing is defined; just the one -- from which it is imported. Examples are Bar.x, Bar.y -- or Bar.Foo. Create such a RdrName with -- mkRdrQual Qual :: ModuleName -> OccName -> RdrName -- | Original name -- -- An original name; the module is the defining module. This is -- used when GHC generates code that will be fed into the renamer (e.g. -- from deriving clauses), but where we want to say "Use Prelude.map -- dammit". One of these can be created with mkOrig Orig :: Module -> OccName -> RdrName -- | Exact name -- -- We know exactly the Name. This is used: -- --
    --
  1. When the parser parses built-in syntax like [] and -- (,), but wants a RdrName from it
  2. --
  3. By Template Haskell, when TH has generated a unique name
  4. --
-- -- Such a RdrName can be created by using getRdrName on a -- Name Exact :: Name -> RdrName -- | Local Reader Environment -- -- This environment is used to store local bindings (let, -- where, lambda, case). It is keyed by OccName, -- because we never use it for qualified names We keep the current -- mapping, *and* the set of all Names in scope Reason: see Note -- [Splicing Exact names] in RnEnv data LocalRdrEnv -- | Global Reader Environment -- -- Keyed by OccName; when looking up a qualified name we look up -- the OccName part, and then check the Provenance to see -- if the appropriate qualification is valid. This saves routinely -- doubling the size of the env by adding both qualified and unqualified -- names to the domain. -- -- The list in the codomain is required because there may be name clashes -- These only get reported on lookup, not on construction -- -- INVARIANT 1: All the members of the list have distinct gre_name -- fields; that is, no duplicate Names -- -- INVARIANT 2: Imported provenance => Name is an ExternalName However -- LocalDefs can have an InternalName. This happens only when -- type-checking a [d| ... |] Template Haskell quotation; see this note -- in RnNames Note [Top-level Names in Template Haskell decl quotes] -- -- INVARIANT 3: If the GlobalRdrEnv maps [occ -> gre], then greOccName -- gre = occ -- -- NB: greOccName gre is usually the same as nameOccName (gre_name gre), -- but not always in the case of record seectors; see greOccName type GlobalRdrEnv = OccEnv [GlobalRdrElt] -- | Global Reader Element -- -- An element of the GlobalRdrEnv data GlobalRdrElt GRE :: Name -> Parent -> Bool -> [ImportSpec] -> GlobalRdrElt [gre_name] :: GlobalRdrElt -> Name [gre_par] :: GlobalRdrElt -> Parent -- | True = the thing was defined locally [gre_lcl] :: GlobalRdrElt -> Bool -- | In scope through these imports [gre_imp] :: GlobalRdrElt -> [ImportSpec] -- | The children of a Name are the things that are abbreviated by the ".." -- notation in export lists. See Note [Parents] data Parent NoParent :: Parent ParentIs :: Name -> Parent [par_is] :: Parent -> Name -- | See Note [Parents for record fields] FldParent :: Name -> Maybe FieldLabelString -> Parent [par_is] :: Parent -> Name [par_lbl] :: Parent -> Maybe FieldLabelString -- | Import Specification -- -- The ImportSpec of something says how it came to be imported -- It's quite elaborate so that we can give accurate unused-name -- warnings. data ImportSpec ImpSpec :: ImpDeclSpec -> ImpItemSpec -> ImportSpec [is_decl] :: ImportSpec -> ImpDeclSpec [is_item] :: ImportSpec -> ImpItemSpec -- | Import Declaration Specification -- -- Describes a particular import declaration and is shared among all the -- Provenances for that decl data ImpDeclSpec ImpDeclSpec :: ModuleName -> ModuleName -> Bool -> SrcSpan -> ImpDeclSpec -- | Module imported, e.g. import Muggle Note the Muggle -- may well not be the defining module for this thing! [is_mod] :: ImpDeclSpec -> ModuleName -- | Import alias, e.g. from as M (or Muggle if there is -- no as clause) [is_as] :: ImpDeclSpec -> ModuleName -- | Was this import qualified? [is_qual] :: ImpDeclSpec -> Bool -- | The location of the entire import declaration [is_dloc] :: ImpDeclSpec -> SrcSpan -- | Import Item Specification -- -- Describes import info a particular Name data ImpItemSpec -- | The import had no import list, or had a hiding list ImpAll :: ImpItemSpec -- | The import had an import list. The is_explicit field is -- True iff the thing was named explicitly in the import -- specs rather than being imported as part of a "..." group. Consider: -- --
--   import C( T(..) )
--   
-- -- Here the constructors of T are not named explicitly; only -- T is named explicitly. ImpSome :: Bool -> SrcSpan -> ImpItemSpec [is_explicit] :: ImpItemSpec -> Bool [is_iloc] :: ImpItemSpec -> SrcSpan -- | Combines AvailInfos from the same family avails may -- have several items with the same availName E.g import Ix( Ix(..), -- index ) will give Ix(Ix,index,range) and Ix(index) We want to combine -- these; addAvail does that nubAvails :: [AvailInfo] -> [AvailInfo] -- | filters an AvailInfo by the given predicate filterAvail :: (Name -> Bool) -> AvailInfo -> [AvailInfo] -> [AvailInfo] -- | filters AvailInfos by the given predicate filterAvails :: (Name -> Bool) -> [AvailInfo] -> [AvailInfo] -- | trims an AvailInfo to keep only a single name trimAvail :: AvailInfo -> Name -> AvailInfo plusAvail :: AvailInfo -> AvailInfo -> AvailInfo -- | Names made available by the availability information, paired -- with the OccName used to refer to each one. -- -- When DuplicateRecordFields is in use, the Name may be -- the mangled name of a record selector (e.g. $sel:foo:MkT) -- while the OccName will be the label of the field (e.g. -- foo). -- -- See Note [Representing fields in AvailInfo]. availNamesWithOccs :: AvailInfo -> [(Name, OccName)] availsNamesWithOccs :: [AvailInfo] -> [(Name, OccName)] -- | Fields made available by the availability information availFlds :: AvailInfo -> [FieldLabel] -- | Names for non-fields made available by the availability information availNonFldNames :: AvailInfo -> [Name] -- | All names made available by the availability information (including -- overloaded selectors) availNamesWithSelectors :: AvailInfo -> [Name] -- | All names made available by the availability information (excluding -- overloaded selectors) availNames :: AvailInfo -> [Name] -- | Just the main name made available, i.e. not the available pieces of -- type or class brought into scope by the GenAvailInfo availName :: AvailInfo -> Name availsToNameEnv :: [AvailInfo] -> NameEnv AvailInfo availsToNameSetWithSelectors :: [AvailInfo] -> NameSet availsToNameSet :: [AvailInfo] -> NameSet avail :: Name -> AvailInfo -- | Compare lexicographically stableAvailCmp :: AvailInfo -> AvailInfo -> Ordering -- | Records what things are "available", i.e. in scope data AvailInfo -- | An ordinary identifier in scope Avail :: Name -> AvailInfo -- | A type or class in scope -- -- The AvailTC Invariant: If the type or class is itself to be in -- scope, it must be first in this list. Thus, typically: -- --
--   AvailTC Eq [Eq, ==, \/=] []
--   
AvailTC :: Name -> [Name] -> [FieldLabel] -> AvailInfo -- | A collection of AvailInfo - several things that are "available" type Avails = [AvailInfo] -- | Field labels are just represented as strings; they are not necessarily -- unique (even within a module) type FieldLabelString = FastString type FieldLabel = FieldLbl Name -- | Fields in an algebraic record type data FieldLbl a FieldLabel :: FieldLabelString -> Bool -> a -> FieldLbl a -- | User-visible label of the field [flLabel] :: FieldLbl a -> FieldLabelString -- | Was DuplicateRecordFields on in the defining module for this datatype? [flIsOverloaded] :: FieldLbl a -> Bool -- | Record selector function [flSelector] :: FieldLbl a -> a emptyArgDocMap :: ArgDocMap emptyDeclDocMap :: DeclDocMap -- | Concat docstrings with two newlines in between. -- -- Empty docstrings are skipped. -- -- If all inputs are empty, Nothing is returned. concatDocs :: [HsDocString] -> Maybe HsDocString -- | Join two docstrings. -- -- Non-empty docstrings are joined with two newlines in between, -- resulting in separate paragraphs. appendDocs :: HsDocString -> HsDocString -> HsDocString ppr_mbDoc :: Maybe LHsDocString -> SDoc -- | Return the contents of a HsDocString as a UTF8-encoded -- ByteString. hsDocStringToByteString :: HsDocString -> ByteString unpackHDS :: HsDocString -> String -- | Create a HsDocString from a UTF8-encoded ByteString. mkHsDocStringUtf8ByteString :: ByteString -> HsDocString mkHsDocString :: String -> HsDocString -- | Haskell Documentation String -- -- Internally this is a UTF8-Encoded ByteString. data HsDocString -- | Located Haskell Documentation String type LHsDocString = Located HsDocString -- | Docs for declarations: functions, data types, instances, methods etc. newtype DeclDocMap DeclDocMap :: Map Name HsDocString -> DeclDocMap -- | Docs for arguments. E.g. function arguments, method arguments. newtype ArgDocMap ArgDocMap :: Map Name (Map Int HsDocString) -> ArgDocMap -- | Given some DefUses and some Uses, find all the uses, -- transitively. The result is a superset of the input Uses; and -- includes things defined in the input DefUses (but only if they -- are used) findUses :: DefUses -> Uses -> Uses -- | Collect all Uses, regardless of whether the group is itself -- used, but remove Defs on the way duUses :: DefUses -> Uses -- | Just like duUses, but Defs are not eliminated from the -- Uses returned allUses :: DefUses -> Uses duDefs :: DefUses -> Defs plusDU :: DefUses -> DefUses -> DefUses mkDUs :: [(Defs, Uses)] -> DefUses usesOnly :: Uses -> DefUses emptyDUs :: DefUses intersectFVs :: FreeVars -> FreeVars -> FreeVars delFVs :: [Name] -> FreeVars -> FreeVars delFV :: Name -> FreeVars -> FreeVars unitFV :: Name -> FreeVars addOneFV :: FreeVars -> Name -> FreeVars mkFVs :: [Name] -> FreeVars plusFV :: FreeVars -> FreeVars -> FreeVars plusFVs :: [FreeVars] -> FreeVars emptyFVs :: FreeVars isEmptyFVs :: NameSet -> Bool -- | Get the elements of a NameSet with some stable ordering. This only -- works for Names that originate in the source code or have been tidied. -- See Note [Deterministic UniqFM] to learn about nondeterminism nameSetElemsStable :: NameSet -> [Name] nameSetAll :: (Name -> Bool) -> NameSet -> Bool nameSetAny :: (Name -> Bool) -> NameSet -> Bool -- | True if there is a non-empty intersection. s1 -- intersectsNameSet s2 doesn't compute s2 if -- s1 is empty intersectsNameSet :: NameSet -> NameSet -> Bool delListFromNameSet :: NameSet -> [Name] -> NameSet intersectNameSet :: NameSet -> NameSet -> NameSet filterNameSet :: (Name -> Bool) -> NameSet -> NameSet delFromNameSet :: NameSet -> Name -> NameSet elemNameSet :: Name -> NameSet -> Bool minusNameSet :: NameSet -> NameSet -> NameSet unionNameSets :: [NameSet] -> NameSet unionNameSet :: NameSet -> NameSet -> NameSet extendNameSet :: NameSet -> Name -> NameSet extendNameSetList :: NameSet -> [Name] -> NameSet mkNameSet :: [Name] -> NameSet unitNameSet :: Name -> NameSet emptyNameSet :: NameSet isEmptyNameSet :: NameSet -> Bool type NameSet = UniqSet Name type FreeVars = NameSet -- | A set of names that are defined somewhere type Defs = NameSet -- | A set of names that are used somewhere type Uses = NameSet -- | (Just ds, us) => The use of any member of the ds -- implies that all the us are used too. Also, us may -- mention ds. -- -- Nothing => Nothing is defined in this group, but -- nevertheless all the uses are essential. Used for instance -- declarations, for example type DefUse = (Maybe Defs, Uses) -- | A number of DefUses in dependency order: earlier Defs -- scope over later Uses In a single (def, use) pair, the defs -- also scope over the uses type DefUses = OrdList DefUse listTyCon :: TyCon typeSymbolKind :: Kind typeNatKind :: Kind -- | Build the type of a small tuple that holds the specified type of thing -- Flattens 1-tuples. See Note [One-tuples]. mkBoxedTupleTy :: [Type] -> Type heqTyCon :: TyCon coercibleTyCon :: TyCon unitTy :: Type liftedTypeKind :: Kind constraintKind :: Kind vecElemTyCon :: TyCon vecCountTyCon :: TyCon runtimeRepTyCon :: TyCon runtimeRepTy :: Type tupleRepDataConTyCon :: TyCon vecRepDataConTyCon :: TyCon liftedRepDataConTyCon :: TyCon doubleRepDataConTy :: Type floatRepDataConTy :: Type addrRepDataConTy :: Type word64RepDataConTy :: Type word32RepDataConTy :: Type word16RepDataConTy :: Type word8RepDataConTy :: Type wordRepDataConTy :: Type int64RepDataConTy :: Type int32RepDataConTy :: Type int16RepDataConTy :: Type int8RepDataConTy :: Type intRepDataConTy :: Type unliftedRepDataConTy :: Type liftedRepDataConTy :: Type vec64DataConTy :: Type vec32DataConTy :: Type vec16DataConTy :: Type vec8DataConTy :: Type vec4DataConTy :: Type vec2DataConTy :: Type doubleElemRepDataConTy :: Type floatElemRepDataConTy :: Type word64ElemRepDataConTy :: Type word32ElemRepDataConTy :: Type word16ElemRepDataConTy :: Type word8ElemRepDataConTy :: Type int64ElemRepDataConTy :: Type int32ElemRepDataConTy :: Type int16ElemRepDataConTy :: Type int8ElemRepDataConTy :: Type anyTypeOfKind :: Kind -> Type -- | Specialization of unboxedTupleSumKind for tuples unboxedTupleKind :: [Type] -> Kind -- | Make a *promoted* list. mkPromotedListTy :: Kind -> [Type] -> Type tupleTyConName :: TupleSort -> Arity -> Name pprPrefixName :: NamedThing a => a -> SDoc pprInfixName :: (Outputable a, NamedThing a) => a -> SDoc getOccFS :: NamedThing a => a -> FastString getOccString :: NamedThing a => a -> String getSrcSpan :: NamedThing a => a -> SrcSpan getSrcLoc :: NamedThing a => a -> SrcLoc -- | Get a string representation of a Name that's unique and stable -- across recompilations. Used for deterministic generation of binds for -- derived instances. eg. -- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String" nameStableString :: Name -> String pprNameDefnLoc :: Name -> SDoc pprDefinedAt :: Name -> SDoc pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc -- | Print the string of Name unqualifiedly directly. pprNameUnqualified :: Name -> SDoc -- | Compare Names lexicographically This only works for Names that -- originate in the source code or have been tidied. stableNameCmp :: Name -> Name -> Ordering -- | Make the Name into an internal name, regardless of what it was -- to begin with localiseName :: Name -> Name tidyNameOcc :: Name -> OccName -> Name setNameLoc :: Name -> SrcSpan -> Name setNameUnique :: Name -> Unique -> Name -- | Make a name for a foreign call mkFCallName :: Unique -> String -> Name mkSysTvName :: Unique -> FastString -> Name mkSystemVarName :: Unique -> FastString -> Name mkSystemNameAt :: Unique -> OccName -> SrcSpan -> Name -- | Create a name brought into being by the compiler mkSystemName :: Unique -> OccName -> Name -- | Create a name which is actually defined by the compiler itself mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name -- | Create a name which definitely originates in the given module mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name mkDerivedInternalName :: (OccName -> OccName) -> Unique -> Name -> Name mkClonedInternalName :: Unique -> Name -> Name -- | Create a name which is (for now at least) local to the current module -- and hence does not need a Module to disambiguate it from other -- Names mkInternalName :: Unique -> OccName -> SrcSpan -> Name isSystemName :: Name -> Bool isVarName :: Name -> Bool isValName :: Name -> Bool isDataConName :: Name -> Bool isTyConName :: Name -> Bool isTyVarName :: Name -> Bool -- | Returns True if the Name comes from some other package: neither this -- package nor the interactive package. nameIsFromExternalPackage :: UnitId -> Name -> Bool nameIsHomePackageImport :: Module -> Name -> Bool nameIsHomePackage :: Module -> Name -> Bool -- | Returns True if the name is (a) Internal (b) External but from the -- specified module (c) External but from the interactive -- package -- -- The key idea is that False means: the entity is defined in some other -- module you can find the details (type, fixity, instances) in some -- interface file those details will be stored in the EPT or HPT -- -- True means: the entity is defined in this module or earlier in the -- GHCi session you can find details (type, fixity, instances) in the -- TcGblEnv or TcLclEnv -- -- The isInteractiveModule part is because successive interactions of a -- GHCi session each give rise to a fresh module (Ghci1, Ghci2, etc), but -- they all come from the magic interactive package; and all the -- details are kept in the TcLclEnv, TcGblEnv, NOT in the HPT or EPT. See -- Note [The interactive package] in HscTypes nameIsLocalOrFrom :: Module -> Name -> Bool nameModule_maybe :: Name -> Maybe Module nameModule :: HasDebugCallStack => Name -> Module isHoleName :: Name -> Bool isInternalName :: Name -> Bool isExternalName :: Name -> Bool isBuiltInSyntax :: Name -> Bool wiredInNameTyThing_maybe :: Name -> Maybe TyThing isWiredInName :: Name -> Bool nameSrcSpan :: Name -> SrcSpan nameSrcLoc :: Name -> SrcLoc nameNameSpace :: Name -> NameSpace nameOccName :: Name -> OccName nameUnique :: Name -> Unique -- | BuiltInSyntax is for things like (:), [] and tuples, -- which have special syntactic forms. They aren't in scope as such. data BuiltInSyntax BuiltInSyntax :: BuiltInSyntax UserSyntax :: BuiltInSyntax -- | A class allowing convenient access to the Name of various -- datatypes class NamedThing a getOccName :: NamedThing a => a -> OccName getName :: NamedThing a => a -> Name mkFunTy :: AnonArgFlag -> Type -> Type -> Type infixr 3 `mkFunTy` -- | Like mkTyCoForAllTy, but does not check the occurrence of the -- binder See Note [Unused coercion variable in ForAllTy] mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type data Type -- | Vanilla type or kind variable (*never* a coercion variable) TyVarTy :: Var -> Type -- | Type application to something other than a TyCon. Parameters: -- -- 1) Function: must not be a TyConApp or CastTy, -- must be another AppTy, or TyVarTy See Note Respecting -- definitional equality about the no CastTy requirement -- -- 2) Argument type AppTy :: Type -> Type -> Type -- | Application of a TyCon, including newtypes and synonyms. -- Invariant: saturated applications of FunTyCon must use -- FunTy and saturated synonyms must use their own constructors. -- However, unsaturated FunTyCons do appear as -- TyConApps. Parameters: -- -- 1) Type constructor being applied to. -- -- 2) Type arguments. Might not have enough type arguments here to -- saturate the constructor. Even type synonyms are not necessarily -- saturated; for example unsaturated type synonyms can appear as the -- right hand side of a type synonym. TyConApp :: TyCon -> [KindOrType] -> Type -- | A Π type. ForAllTy :: {-# UNPACK #-} !TyCoVarBinder -> Type -> Type -- | t1 -> t2 Very common, so an important special case See Note -- [Function types] FunTy :: AnonArgFlag -> Type -> Type -> Type [ft_af] :: Type -> AnonArgFlag [ft_arg] :: Type -> Type [ft_res] :: Type -> Type -- | Type literals are similar to type constructors. LitTy :: TyLit -> Type -- | A kind cast. The coercion is always nominal. INVARIANT: The cast is -- never refl. INVARIANT: The Type is not a CastTy (use TransCo instead) -- See Note Respecting definitional equality and (EQ3) CastTy :: Type -> KindCoercion -> Type -- | Injection of a Coercion into a type This should only ever be used in -- the RHS of an AppTy, in the list of a TyConApp, when applying a -- promoted GADT data constructor CoercionTy :: Coercion -> Type -- | A global typecheckable-thing, essentially anything that has a name. -- Not to be confused with a TcTyThing, which is also a -- typecheckable thing but in the *local* context. See TcEnv for -- how to retrieve a TyThing given a Name. data TyThing AnId :: Id -> TyThing AConLike :: ConLike -> TyThing ATyCon :: TyCon -> TyThing ACoAxiom :: CoAxiom Branched -> TyThing -- | A Coercion is concrete evidence of the equality/convertibility -- of two types. data Coercion Refl :: Type -> Coercion GRefl :: Role -> Type -> MCoercionN -> Coercion TyConAppCo :: Role -> TyCon -> [Coercion] -> Coercion AppCo :: Coercion -> CoercionN -> Coercion ForAllCo :: TyCoVar -> KindCoercion -> Coercion -> Coercion FunCo :: Role -> Coercion -> Coercion -> Coercion CoVarCo :: CoVar -> Coercion AxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion AxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion UnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion SymCo :: Coercion -> Coercion TransCo :: Coercion -> Coercion -> Coercion NthCo :: Role -> Int -> Coercion -> Coercion LRCo :: LeftOrRight -> CoercionN -> Coercion InstCo :: Coercion -> CoercionN -> Coercion KindCo :: Coercion -> Coercion SubCo :: CoercionN -> Coercion -- | See Note [Coercion holes] Only present during typechecking HoleCo :: CoercionHole -> Coercion -- | For simplicity, we have just one UnivCo that represents a coercion -- from some type to some other type, with (in general) no restrictions -- on the type. The UnivCoProvenance specifies more exactly what the -- coercion really is and why a program should (or shouldn't!) trust the -- coercion. It is reasonable to consider each constructor of -- UnivCoProvenance as a totally independent coercion form; their -- only commonality is that they don't tell you what types they coercion -- between. (That info is in the UnivCo constructor of -- Coercion. data UnivCoProvenance -- | From unsafeCoerce#. These are unsound. UnsafeCoerceProv :: UnivCoProvenance -- | See Note [Phantom coercions]. Only in Phantom roled coercions PhantomProv :: KindCoercion -> UnivCoProvenance -- | From the fact that any two coercions are considered equivalent. See -- Note [ProofIrrelProv]. Can be used in Nominal or Representational -- coercions ProofIrrelProv :: KindCoercion -> UnivCoProvenance -- | From a plugin, which asserts that this coercion is sound. The string -- is for the use of the plugin. PluginProv :: String -> UnivCoProvenance data TyLit NumTyLit :: Integer -> TyLit StrTyLit :: FastString -> TyLit -- | A TyCoBinder represents an argument to a function. TyCoBinders -- can be dependent (Named) or nondependent (Anon). They -- may also be visible or not. See Note [TyCoBinders] data TyCoBinder Named :: TyCoVarBinder -> TyCoBinder Anon :: AnonArgFlag -> Type -> TyCoBinder -- | A semantically more meaningful type to represent what may or may not -- be a useful Coercion. data MCoercion MRefl :: MCoercion MCo :: Coercion -> MCoercion -- | A type of the form p of constraint kind represents a value -- whose type is the Haskell predicate p, where a predicate is -- what occurs before the => in a Haskell type. -- -- We use PredType as documentation to mark those types that we -- guarantee to have this kind. -- -- It can be expanded into its representation, but: -- -- -- -- Consider these examples: -- --
--   f :: (Eq a) => a -> Int
--   g :: (?x :: Int -> Int) => a -> Int
--   h :: (r\l) => {r} => {l::Int | r}
--   
-- -- Here the Eq a and ?x :: Int -> Int and -- rl are all called "predicates" type PredType = Type -- | The key type representing kinds in the compiler. type Kind = Type -- | A collection of PredTypes type ThetaType = [PredType] type CoercionN = Coercion type MCoercionN = MCoercion -- | Argument Flag -- -- Is something required to appear in source Haskell (Required), -- permitted by request (Specified) (visible type application), or -- prohibited entirely from appearing in source Haskell -- (Inferred)? See Note [VarBndrs, TyCoVarBinders, TyConBinders, -- and visibility] in TyCoRep data ArgFlag Inferred :: ArgFlag Specified :: ArgFlag Required :: ArgFlag -- | The non-dependent version of ArgFlag. data AnonArgFlag -- | Used for (->): an ordinary non-dependent arrow. The -- argument is visible in source code. VisArg :: AnonArgFlag -- | Used for (=>): a non-dependent predicate arrow. The -- argument is invisible in source code. InvisArg :: AnonArgFlag -- | Variable -- -- Essentially a typed Name, that may also contain some additional -- information about the Var and its use sites. data Var traceCmd :: DynFlags -> String -> String -> IO a -> IO a -- | Checks if given WarnMsg is a fatal warning. isWarnMsgFatal :: DynFlags -> WarnMsg -> Maybe (Maybe WarningFlag) prettyPrintGhcErrors :: ExceptionMonad m => DynFlags -> m a -> m a -- | Like logInfo but with SevOutput rather then -- SevInfo logOutput :: DynFlags -> PprStyle -> MsgDoc -> IO () logInfo :: DynFlags -> PprStyle -> MsgDoc -> IO () printOutputForUser :: DynFlags -> PrintUnqualified -> MsgDoc -> IO () printInfoForUser :: DynFlags -> PrintUnqualified -> MsgDoc -> IO () putMsg :: DynFlags -> MsgDoc -> IO () debugTraceMsg :: DynFlags -> Int -> MsgDoc -> IO () -- | Same as withTiming, but doesn't print timings in the console -- (when given -vN, N >= 2 or -- -ddump-timings) and gets the DynFlags from the given Monad. -- -- See Note [withTiming] for more. withTimingSilentD :: (MonadIO m, HasDynFlags m) => SDoc -> (a -> ()) -> m a -> m a -- | Same as withTiming, but doesn't print timings in the console -- (when given -vN, N >= 2 or -- -ddump-timings). -- -- See Note [withTiming] for more. withTimingSilent :: MonadIO m => DynFlags -> SDoc -> (a -> ()) -> m a -> m a -- | Like withTiming but get DynFlags from the Monad. withTimingD :: (MonadIO m, HasDynFlags m) => SDoc -> (a -> ()) -> m a -> m a -- | Time a compilation phase. -- -- When timings are enabled (e.g. with the -v2 flag), the -- allocations and CPU time used by the phase will be reported to stderr. -- Consider a typical usage: withTiming getDynFlags (text "simplify") -- force PrintTimings pass. When timings are enabled the following -- costs are included in the produced accounting, -- -- -- -- The choice of the force function depends upon the amount of -- forcing desired; the goal here is to ensure that the cost of -- evaluating the result is, to the greatest extent possible, included in -- the accounting provided by withTiming. Often the pass already -- sufficiently forces its result during construction; in this case -- const () is a reasonable choice. In other cases, it is -- necessary to evaluate the result to normal form, in which case -- something like Control.DeepSeq.rnf is appropriate. -- -- To avoid adversely affecting compiler performance when timings are not -- requested, the result is only forced when timings are enabled. -- -- See Note [withTiming] for more. withTiming :: MonadIO m => DynFlags -> SDoc -> (a -> ()) -> m a -> m a showPass :: DynFlags -> String -> IO () compilationProgressMsg :: DynFlags -> String -> IO () fatalErrorMsg'' :: FatalMessager -> String -> IO () fatalErrorMsg :: DynFlags -> MsgDoc -> IO () warningMsg :: DynFlags -> MsgDoc -> IO () errorMsg :: DynFlags -> MsgDoc -> IO () -- | Write out a dump. If --dump-to-file is set then this goes to a file. -- otherwise emit to stdout. -- -- When hdr is empty, we print in a more compact format (no -- separators and blank lines) -- -- The DumpFlag is used only to choose the filename to use if -- --dump-to-file is used; it is not used to decide whether to -- dump the output dumpSDocWithStyle :: PprStyle -> DynFlags -> DumpFlag -> String -> SDoc -> IO () -- | A wrapper around dumpSDocWithStyle which uses PprUser -- style. dumpSDocForUser :: DynFlags -> PrintUnqualified -> DumpFlag -> String -> SDoc -> IO () mkDumpDoc :: String -> SDoc -> SDoc -- | a wrapper around dumpSDoc. First check whether the dump flag is -- set Do nothing if it is unset -- -- Unlike dumpIfSet_dyn, has a printer argument but no header -- argument dumpIfSet_dyn_printer :: PrintUnqualified -> DynFlags -> DumpFlag -> SDoc -> IO () -- | a wrapper around dumpSDoc. First check whether the dump flag is -- set Do nothing if it is unset dumpIfSet_dyn :: DynFlags -> DumpFlag -> String -> SDoc -> IO () dumpIfSet :: DynFlags -> Bool -> String -> SDoc -> IO () doIfSet_dyn :: DynFlags -> GeneralFlag -> IO () -> IO () doIfSet :: Bool -> IO () -> IO () ghcExit :: DynFlags -> Int -> IO () pprLocErrMsg :: ErrMsg -> SDoc pprErrMsgBagWithLoc :: Bag ErrMsg -> [SDoc] formatErrDoc :: DynFlags -> ErrDoc -> SDoc printBagOfErrors :: DynFlags -> Bag ErrMsg -> IO () warningsToMessages :: DynFlags -> WarningMessages -> Messages errorsFound :: DynFlags -> Messages -> Bool isEmptyMessages :: Messages -> Bool emptyMessages :: Messages -- | Variant that doesn't care about qualified/unqualified names mkPlainWarnMsg :: DynFlags -> SrcSpan -> MsgDoc -> ErrMsg -- | A short (one-line) error message mkWarnMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> ErrMsg -- | A long (multi-line) error message mkLongWarnMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> MsgDoc -> ErrMsg -- | Variant that doesn't care about qualified/unqualified names mkPlainErrMsg :: DynFlags -> SrcSpan -> MsgDoc -> ErrMsg -- | A short (one-line) error message mkErrMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> ErrMsg -- | A long (multi-line) error message mkLongErrMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> MsgDoc -> ErrMsg mkErrDoc :: DynFlags -> SrcSpan -> PrintUnqualified -> ErrDoc -> ErrMsg makeIntoWarning :: WarnReason -> ErrMsg -> ErrMsg pprMessageBag :: Bag MsgDoc -> SDoc errDoc :: [MsgDoc] -> [MsgDoc] -> [MsgDoc] -> ErrDoc unionMessages :: Messages -> Messages -> Messages orValid :: Validity -> Validity -> Validity getInvalids :: [Validity] -> [MsgDoc] -- | If they aren't all valid, return the first allValid :: [Validity] -> Validity andValid :: Validity -> Validity -> Validity isValid :: Validity -> Bool data Validity -- | Everything is fine IsValid :: Validity -- | A problem, and some indication of why NotValid :: MsgDoc -> Validity type Messages = (WarningMessages, ErrorMessages) type WarningMessages = Bag WarnMsg type ErrorMessages = Bag ErrMsg data ErrMsg -- | Categorise error msgs by their importance. This is so each section can -- be rendered visually distinct. See Note [Error report] for where these -- come from. data ErrDoc type WarnMsg = ErrMsg tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName) avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv initTidyOccEnv :: [OccName] -> TidyOccEnv emptyTidyOccEnv :: TidyOccEnv mkMethodOcc :: OccName -> OccName mkDataCOcc :: OccName -> OccSet -> OccName mkDataTOcc :: OccName -> OccSet -> OccName mkDFunOcc :: String -> Bool -> OccSet -> OccName -- | Derive a name for the representation type constructor of a -- data/newtype instance. mkInstTyTcOcc :: String -> OccSet -> OccName mkLocalOcc :: Unique -> OccName -> OccName mkSuperDictSelOcc :: Int -> OccName -> OccName mkSuperDictAuxOcc :: Int -> OccName -> OccName mkDataConWorkerOcc :: OccName -> OccName mkRecFldSelOcc :: String -> OccName mkGen1R :: OccName -> OccName mkGenR :: OccName -> OccName mkTyConRepOcc :: OccName -> OccName mkMaxTagOcc :: OccName -> OccName mkTag2ConOcc :: OccName -> OccName mkCon2TagOcc :: OccName -> OccName mkEqPredCoOcc :: OccName -> OccName mkInstTyCoOcc :: OccName -> OccName mkNewTyCoOcc :: OccName -> OccName mkClassDataConOcc :: OccName -> OccName mkRepEqOcc :: OccName -> OccName mkForeignExportOcc :: OccName -> OccName mkSpecOcc :: OccName -> OccName mkIPOcc :: OccName -> OccName mkDictOcc :: OccName -> OccName mkClassOpAuxOcc :: OccName -> OccName mkDefaultMethodOcc :: OccName -> OccName mkBuilderOcc :: OccName -> OccName mkMatcherOcc :: OccName -> OccName mkWorkerOcc :: OccName -> OccName mkDataConWrapperOcc :: OccName -> OccName -- | Is an OccName one of a Typeable TyCon or -- Module binding? This is needed as these bindings are renamed -- differently. See Note [Grand plan for Typeable] in TcTypeable. isTypeableBindOcc :: OccName -> Bool isDefaultMethodOcc :: OccName -> Bool -- | Test for definitions internally generated by GHC. This predicte is -- used to suppress printing of internal definitions in some debug prints isDerivedOccName :: OccName -> Bool -- | Haskell 98 encourages compilers to suppress warnings about unsed names -- in a pattern if they start with _: this implements that test startsWithUnderscore :: OccName -> Bool -- | Wrap parens around an operator parenSymOcc :: OccName -> SDoc -> SDoc -- | Test if the OccName is that for any operator (whether it is a -- data constructor or variable or whatever) isSymOcc :: OccName -> Bool -- | Test if the OccName is a data constructor that starts with a -- symbol (e.g. :, or []) isDataSymOcc :: OccName -> Bool isDataOcc :: OccName -> Bool -- | Value OccNamess are those that are either in the -- variable or data constructor namespaces isValOcc :: OccName -> Bool isTcOcc :: OccName -> Bool isTvOcc :: OccName -> Bool isVarOcc :: OccName -> Bool setOccNameSpace :: NameSpace -> OccName -> OccName occNameString :: OccName -> String filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet intersectsOccSet :: OccSet -> OccSet -> Bool intersectOccSet :: OccSet -> OccSet -> OccSet isEmptyOccSet :: OccSet -> Bool elemOccSet :: OccName -> OccSet -> Bool minusOccSet :: OccSet -> OccSet -> OccSet unionManyOccSets :: [OccSet] -> OccSet unionOccSets :: OccSet -> OccSet -> OccSet extendOccSetList :: OccSet -> [OccName] -> OccSet extendOccSet :: OccSet -> OccName -> OccSet mkOccSet :: [OccName] -> OccSet unitOccSet :: OccName -> OccSet emptyOccSet :: OccSet pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a delFromOccEnv :: OccEnv a -> OccName -> OccEnv a mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a occEnvElts :: OccEnv a -> [a] foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b elemOccEnv :: OccName -> OccEnv a -> Bool mkOccEnv :: [(OccName, a)] -> OccEnv a lookupOccEnv :: OccEnv a -> OccName -> Maybe a extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a unitOccEnv :: OccName -> a -> OccEnv a emptyOccEnv :: OccEnv a nameSpacesRelated :: NameSpace -> NameSpace -> Bool demoteOccName :: OccName -> Maybe OccName mkClsOccFS :: FastString -> OccName mkClsOcc :: String -> OccName mkTcOccFS :: FastString -> OccName mkTcOcc :: String -> OccName mkTyVarOccFS :: FastString -> OccName mkTyVarOcc :: String -> OccName mkDataOccFS :: FastString -> OccName mkDataOcc :: String -> OccName mkVarOccFS :: FastString -> OccName mkVarOcc :: String -> OccName mkOccNameFS :: NameSpace -> FastString -> OccName mkOccName :: NameSpace -> String -> OccName pprOccName :: OccName -> SDoc pprNameSpaceBrief :: NameSpace -> SDoc pprNonVarNameSpace :: NameSpace -> SDoc pprNameSpace :: NameSpace -> SDoc isValNameSpace :: NameSpace -> Bool isVarNameSpace :: NameSpace -> Bool isTvNameSpace :: NameSpace -> Bool isTcClsNameSpace :: NameSpace -> Bool isDataConNameSpace :: NameSpace -> Bool tvName :: NameSpace srcDataName :: NameSpace dataName :: NameSpace tcClsName :: NameSpace clsName :: NameSpace tcName :: NameSpace data NameSpace -- | Other names in the compiler add additional information to an OccName. -- This class provides a consistent way to access the underlying OccName. class HasOccName name occName :: HasOccName name => name -> OccName data OccEnv a type OccSet = UniqSet OccName type TidyOccEnv = UniqFM Int -- | An empty FilesToClean emptyFilesToClean :: FilesToClean isBmi2Enabled :: DynFlags -> Bool isBmiEnabled :: DynFlags -> Bool isAvx512pfEnabled :: DynFlags -> Bool isAvx512fEnabled :: DynFlags -> Bool isAvx512erEnabled :: DynFlags -> Bool isAvx512cdEnabled :: DynFlags -> Bool isAvx2Enabled :: DynFlags -> Bool isAvxEnabled :: DynFlags -> Bool isSse4_2Enabled :: DynFlags -> Bool isSse2Enabled :: DynFlags -> Bool isSseEnabled :: DynFlags -> Bool setUnsafeGlobalDynFlags :: DynFlags -> IO () -- | Resolve any internal inconsistencies in a set of DynFlags. -- Returns the consistent DynFlags as well as a list of warnings -- to report to the user. makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String]) tARGET_MAX_WORD :: DynFlags -> Integer tARGET_MAX_INT :: DynFlags -> Integer tARGET_MIN_INT :: DynFlags -> Integer mAX_PTR_TAG :: DynFlags -> Int tAG_MASK :: DynFlags -> Int wordAlignment :: DynFlags -> Alignment wORD_SIZE_IN_BITS :: DynFlags -> Int bLOCK_SIZE_W :: DynFlags -> Int iLDV_STATE_USE :: DynFlags -> Integer iLDV_STATE_CREATE :: DynFlags -> Integer iLDV_CREATE_MASK :: DynFlags -> Integer lDV_SHIFT :: DynFlags -> Int dYNAMIC_BY_DEFAULT :: DynFlags -> Bool wORDS_BIGENDIAN :: DynFlags -> Bool tAG_BITS :: DynFlags -> Int bITMAP_BITS_SHIFT :: DynFlags -> Int cLONG_LONG_SIZE :: DynFlags -> Int cLONG_SIZE :: DynFlags -> Int cINT_SIZE :: DynFlags -> Int dOUBLE_SIZE :: DynFlags -> Int wORD_SIZE :: DynFlags -> Int aP_STACK_SPLIM :: DynFlags -> Int rESERVED_STACK_WORDS :: DynFlags -> Int rESERVED_C_STACK_BYTES :: DynFlags -> Int mAX_Real_Long_REG :: DynFlags -> Int mAX_Real_XMM_REG :: DynFlags -> Int mAX_Real_Double_REG :: DynFlags -> Int mAX_Real_Float_REG :: DynFlags -> Int mAX_Real_Vanilla_REG :: DynFlags -> Int mAX_XMM_REG :: DynFlags -> Int mAX_Long_REG :: DynFlags -> Int mAX_Double_REG :: DynFlags -> Int mAX_Float_REG :: DynFlags -> Int mAX_Vanilla_REG :: DynFlags -> Int mUT_ARR_PTRS_CARD_BITS :: DynFlags -> Int mAX_CHARLIKE :: DynFlags -> Int mIN_CHARLIKE :: DynFlags -> Int mAX_INTLIKE :: DynFlags -> Int mIN_INTLIKE :: DynFlags -> Int mIN_PAYLOAD_SIZE :: DynFlags -> Int mAX_SPEC_AP_SIZE :: DynFlags -> Int mAX_SPEC_SELECTEE_SIZE :: DynFlags -> Int oFFSET_StgFunInfoExtraRev_arity :: DynFlags -> Int sIZEOF_StgFunInfoExtraRev :: DynFlags -> Int oFFSET_StgFunInfoExtraFwd_arity :: DynFlags -> Int oFFSET_StgUpdateFrame_updatee :: DynFlags -> Int oFFSET_StgStack_stack :: DynFlags -> Int oFFSET_StgStack_sp :: DynFlags -> Int oFFSET_StgTSO_stackobj :: DynFlags -> Int oFFSET_StgTSO_cccs :: DynFlags -> Int oFFSET_StgTSO_alloc_limit :: DynFlags -> Int oFFSET_StgArrBytes_bytes :: DynFlags -> Int sIZEOF_StgArrBytes_NoHdr :: DynFlags -> Int oFFSET_StgSmallMutArrPtrs_ptrs :: DynFlags -> Int sIZEOF_StgSmallMutArrPtrs_NoHdr :: DynFlags -> Int oFFSET_StgMutArrPtrs_size :: DynFlags -> Int oFFSET_StgMutArrPtrs_ptrs :: DynFlags -> Int sIZEOF_StgMutArrPtrs_NoHdr :: DynFlags -> Int sIZEOF_StgUpdateFrame_NoHdr :: DynFlags -> Int oFFSET_StgEntCounter_entry_count :: DynFlags -> Int oFFSET_StgEntCounter_link :: DynFlags -> Int oFFSET_StgEntCounter_registeredp :: DynFlags -> Int oFFSET_StgEntCounter_allocd :: DynFlags -> Int oFFSET_StgEntCounter_allocs :: DynFlags -> Int sIZEOF_StgSMPThunkHeader :: DynFlags -> Int oFFSET_StgHeader_ldvw :: DynFlags -> Int oFFSET_StgHeader_ccs :: DynFlags -> Int oFFSET_CostCentreStack_scc_count :: DynFlags -> Int oFFSET_CostCentreStack_mem_alloc :: DynFlags -> Int sIZEOF_CostCentreStack :: DynFlags -> Int oFFSET_bdescr_flags :: DynFlags -> Int oFFSET_bdescr_blocks :: DynFlags -> Int oFFSET_bdescr_free :: DynFlags -> Int oFFSET_bdescr_start :: DynFlags -> Int oFFSET_Capability_r :: DynFlags -> Int oFFSET_stgGCFun :: DynFlags -> Int oFFSET_stgGCEnter1 :: DynFlags -> Int oFFSET_stgEagerBlackholeInfo :: DynFlags -> Int oFFSET_StgRegTable_rHpAlloc :: DynFlags -> Int oFFSET_StgRegTable_rCurrentNursery :: DynFlags -> Int oFFSET_StgRegTable_rCurrentTSO :: DynFlags -> Int oFFSET_StgRegTable_rCCCS :: DynFlags -> Int oFFSET_StgRegTable_rHpLim :: DynFlags -> Int oFFSET_StgRegTable_rHp :: DynFlags -> Int oFFSET_StgRegTable_rSpLim :: DynFlags -> Int oFFSET_StgRegTable_rSp :: DynFlags -> Int oFFSET_StgRegTable_rL1 :: DynFlags -> Int oFFSET_StgRegTable_rZMM6 :: DynFlags -> Int oFFSET_StgRegTable_rZMM5 :: DynFlags -> Int oFFSET_StgRegTable_rZMM4 :: DynFlags -> Int oFFSET_StgRegTable_rZMM3 :: DynFlags -> Int oFFSET_StgRegTable_rZMM2 :: DynFlags -> Int oFFSET_StgRegTable_rZMM1 :: DynFlags -> Int oFFSET_StgRegTable_rYMM6 :: DynFlags -> Int oFFSET_StgRegTable_rYMM5 :: DynFlags -> Int oFFSET_StgRegTable_rYMM4 :: DynFlags -> Int oFFSET_StgRegTable_rYMM3 :: DynFlags -> Int oFFSET_StgRegTable_rYMM2 :: DynFlags -> Int oFFSET_StgRegTable_rYMM1 :: DynFlags -> Int oFFSET_StgRegTable_rXMM6 :: DynFlags -> Int oFFSET_StgRegTable_rXMM5 :: DynFlags -> Int oFFSET_StgRegTable_rXMM4 :: DynFlags -> Int oFFSET_StgRegTable_rXMM3 :: DynFlags -> Int oFFSET_StgRegTable_rXMM2 :: DynFlags -> Int oFFSET_StgRegTable_rXMM1 :: DynFlags -> Int oFFSET_StgRegTable_rD6 :: DynFlags -> Int oFFSET_StgRegTable_rD5 :: DynFlags -> Int oFFSET_StgRegTable_rD4 :: DynFlags -> Int oFFSET_StgRegTable_rD3 :: DynFlags -> Int oFFSET_StgRegTable_rD2 :: DynFlags -> Int oFFSET_StgRegTable_rD1 :: DynFlags -> Int oFFSET_StgRegTable_rF6 :: DynFlags -> Int oFFSET_StgRegTable_rF5 :: DynFlags -> Int oFFSET_StgRegTable_rF4 :: DynFlags -> Int oFFSET_StgRegTable_rF3 :: DynFlags -> Int oFFSET_StgRegTable_rF2 :: DynFlags -> Int oFFSET_StgRegTable_rF1 :: DynFlags -> Int oFFSET_StgRegTable_rR10 :: DynFlags -> Int oFFSET_StgRegTable_rR9 :: DynFlags -> Int oFFSET_StgRegTable_rR8 :: DynFlags -> Int oFFSET_StgRegTable_rR7 :: DynFlags -> Int oFFSET_StgRegTable_rR6 :: DynFlags -> Int oFFSET_StgRegTable_rR5 :: DynFlags -> Int oFFSET_StgRegTable_rR4 :: DynFlags -> Int oFFSET_StgRegTable_rR3 :: DynFlags -> Int oFFSET_StgRegTable_rR2 :: DynFlags -> Int oFFSET_StgRegTable_rR1 :: DynFlags -> Int tICKY_BIN_COUNT :: DynFlags -> Int bLOCKS_PER_MBLOCK :: DynFlags -> Int bLOCK_SIZE :: DynFlags -> Int pROF_HDR_SIZE :: DynFlags -> Int sTD_HDR_SIZE :: DynFlags -> Int cONTROL_GROUP_CONST_291 :: DynFlags -> Int compilerInfo :: DynFlags -> [(String, String)] picPOpts :: DynFlags -> [String] picCCOpts :: DynFlags -> [String] setTmpDir :: FilePath -> DynFlags -> DynFlags setFlagsFromEnvFile :: FilePath -> String -> DynP () canonicalizeModuleIfHome :: DynFlags -> Module -> Module -- | Given a ModuleName of a signature in the home library, find out -- how it is instantiated. E.g., the canonical form of A in -- p[A=q[]:A] is q[]:A. canonicalizeHomeModule :: DynFlags -> ModuleName -> Module setUnitId :: String -> DynFlags -> DynFlags unSetGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags setGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags addWay' :: Way -> DynFlags -> DynFlags dynamicGhc :: Bool -- | Was the runtime system built with profiling enabled? rtsIsProfiled :: Bool glasgowExtsFlags :: [Extension] -- | Warning group hierarchies, where there is an explicit inclusion -- relation. -- -- Each inner list is a hierarchy of warning groups, ordered from -- smallest to largest, where each group is a superset of the one before -- it. -- -- Separating this from warningGroups allows for multiple -- hierarchies with no inherent relation to be defined. -- -- The special-case Weverything group is not included. warningHierarchies :: [[String]] -- | Warning groups. -- -- As all warnings are in the Weverything set, it is ignored when -- displaying to the user which group a warning is in. warningGroups :: [(String, [WarningFlag])] -- | These -Xblah flags can all be reversed with -XNoblah xFlags :: [FlagSpec Extension] supportedLanguagesAndExtensions :: PlatformMini -> [String] -- | These -f<blah> flags can all be reversed with -- -fno-<blah> fLangFlags :: [FlagSpec Extension] -- | These -f<blah> flags can all be reversed with -- -fno-<blah> fFlags :: [FlagSpec GeneralFlag] -- | These -W<blah> flags can all be reversed with -- -Wno-<blah> wWarningFlags :: [FlagSpec WarningFlag] -- | Make a list of flags for shell completion. Filter all available flags -- into two groups, for interactive GHC vs all other. flagsForCompletion :: Bool -> [String] flagsPackage :: [Flag (CmdLineP DynFlags)] flagsDynamic :: [Flag (CmdLineP DynFlags)] flagsAll :: [Flag (CmdLineP DynFlags)] -- | All dynamic flags option strings without the deprecated ones. These -- are the user facing strings for enabling and disabling options. allNonDeprecatedFlags :: [String] updateWays :: DynFlags -> DynFlags -- | Write an error or warning to the LogOutput. putLogMsg :: DynFlags -> WarnReason -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO () -- | Parses the dynamically set flags for GHC. This is the most general -- form of the dynamic flag parser that the other methods simply wrap. It -- allows saying which flags are valid flags and indicating if we are -- parsing arguments from the command line or from a file pragma. parseDynamicFlagsFull :: MonadIO m => [Flag (CmdLineP DynFlags)] -> Bool -> DynFlags -> [Located String] -> m (DynFlags, [Located String], [Warn]) -- | Like parseDynamicFlagsCmdLine but does not allow the package -- flags (-package, -hide-package, -ignore-package, -hide-all-packages, -- -package-db). Used to parse flags set in a modules pragma. parseDynamicFilePragma :: MonadIO m => DynFlags -> [Located String] -> m (DynFlags, [Located String], [Warn]) -- | Parse dynamic flags from a list of command line arguments. Returns the -- parsed DynFlags, the left-over arguments, and a list of -- warnings. Throws a UsageError if errors occurred during parsing -- (such as unknown flags or missing arguments). parseDynamicFlagsCmdLine :: MonadIO m => DynFlags -> [Located String] -> m (DynFlags, [Located String], [Warn]) -- | Sets the DynFlags to be appropriate to the optimisation level updOptLevel :: Int -> DynFlags -> DynFlags addPluginModuleName :: String -> DynFlags -> DynFlags thisPackage :: DynFlags -> UnitId thisUnitIdInsts :: DynFlags -> [(ModuleName, Module)] thisComponentId :: DynFlags -> ComponentId -- | Gets the verbosity flag for the current verbosity level. This is fed -- to other tools, so GHC-specific verbosity flags like -- -ddump-most are not included getVerbFlags :: DynFlags -> [String] -- | Retrieve the options corresponding to a particular opt_* -- field in the correct order getOpts :: DynFlags -> (DynFlags -> [a]) -> [a] -- | A list of unsafe flags under Safe Haskell. Tuple elements are: * name -- of the flag * function to get srcspan that enabled the flag * function -- to test if the flag is on * function to turn the flag off unsafeFlagsForInfer :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)] -- | A list of unsafe flags under Safe Haskell. Tuple elements are: * name -- of the flag * function to get srcspan that enabled the flag * function -- to test if the flag is on * function to turn the flag off unsafeFlags :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)] -- | Are all implicit imports required to be safe for this Safe Haskell -- mode? Implicit imports are things in the prelude. e.g System.IO when -- print is used. safeImplicitImpsReq :: DynFlags -> Bool -- | Are all direct imports required to be safe for this Safe Haskell mode? -- Direct imports are when the code explicitly imports a module safeDirectImpsReq :: DynFlags -> Bool -- | Test if Safe Imports are on in some form safeImportsOn :: DynFlags -> Bool -- | Is the Safe Haskell safe inference mode active safeInferOn :: DynFlags -> Bool -- | Is the Safe Haskell safe language in use safeLanguageOn :: DynFlags -> Bool safeHaskellModeEnabled :: DynFlags -> Bool -- | Is Safe Haskell on in some way (including inference mode) safeHaskellOn :: DynFlags -> Bool -- | Is the -fpackage-trust mode on packageTrustOn :: DynFlags -> Bool -- | Some modules have dependencies on others through the DynFlags rather -- than textual imports dynFlagDependencies :: DynFlags -> [ModuleName] lang_set :: DynFlags -> Maybe Language -> DynFlags -- | Set or unset a Extension, unless it has been explicitly set or -- unset before. xopt_set_unlessExplSpec :: Extension -> (DynFlags -> Extension -> DynFlags) -> DynFlags -> DynFlags -- | Unset a Extension xopt_unset :: DynFlags -> Extension -> DynFlags -- | Set a Extension xopt_set :: DynFlags -> Extension -> DynFlags -- | Test whether a Extension is set xopt :: Extension -> DynFlags -> Bool -- | Mark a WarningFlag as not fatal wopt_unset_fatal :: DynFlags -> WarningFlag -> DynFlags -- | Mark a WarningFlag as fatal (do not set the flag) wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags -- | Test whether a WarningFlag is set as fatal wopt_fatal :: WarningFlag -> DynFlags -> Bool -- | Unset a WarningFlag wopt_unset :: DynFlags -> WarningFlag -> DynFlags -- | Set a WarningFlag wopt_set :: DynFlags -> WarningFlag -> DynFlags -- | Test whether a WarningFlag is set wopt :: WarningFlag -> DynFlags -> Bool -- | Unset a GeneralFlag gopt_unset :: DynFlags -> GeneralFlag -> DynFlags -- | Set a GeneralFlag gopt_set :: DynFlags -> GeneralFlag -> DynFlags -- | Test whether a GeneralFlag is set gopt :: GeneralFlag -> DynFlags -> Bool -- | Unset a DumpFlag dopt_unset :: DynFlags -> DumpFlag -> DynFlags -- | Set a DumpFlag dopt_set :: DynFlags -> DumpFlag -> DynFlags -- | Test whether a DumpFlag is set dopt :: DumpFlag -> DynFlags -> Bool hasNoOptCoercion :: DynFlags -> Bool hasNoStateHack :: DynFlags -> Bool -- | The language extensions implied by the various language variants. When -- updating this be sure to update the flag documentation in -- docsusers-guideglasgow_exts.rst. languageExtensions :: Maybe Language -> [Extension] defaultFlushErr :: FlushErr defaultFlushOut :: FlushOut defaultLogActionHPutStrDoc :: DynFlags -> Handle -> SDoc -> PprStyle -> IO () -- | Like defaultLogActionHPutStrDoc but appends an extra newline. defaultLogActionHPrintDoc :: DynFlags -> Handle -> SDoc -> PprStyle -> IO () defaultLogAction :: LogAction defaultFatalMessager :: FatalMessager interpreterDynamic :: DynFlags -> Bool interpreterProfiled :: DynFlags -> Bool interpWays :: [Way] defaultWays :: Settings -> [Way] -- | The normal DynFlags. Note that they are not suitable for use in -- this form and must be fully initialized by runGhc first. defaultDynFlags :: Settings -> LlvmConfig -> DynFlags -- | Used by runGhc to partially initialize a new DynFlags -- value initDynFlags :: DynFlags -> IO DynFlags -- | Compute the path of the dynamic object corresponding to an object -- file. dynamicOutputFile :: DynFlags -> FilePath -> FilePath dynamicTooMkDynamicDynFlags :: DynFlags -> DynFlags whenCannotGenerateDynamicToo :: MonadIO m => DynFlags -> m () -> m () ifGeneratingDynamicToo :: MonadIO m => DynFlags -> m a -> m a -> m a whenGeneratingDynamicToo :: MonadIO m => DynFlags -> m () -> m () wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag] wayGeneralFlags :: Platform -> Way -> [GeneralFlag] wayRTSOnly :: Way -> Bool mkBuildTag :: [Way] -> String -- | Are we building with -fPIE or -fPIC enabled? positionIndependent :: DynFlags -> Bool defaultObjectTarget :: DynFlags -> HscTarget packageFlagsChanged :: DynFlags -> DynFlags -> Bool isNoLink :: GhcLink -> Bool isOneShot :: GhcMode -> Bool -- | Does this target retain *all* top-level bindings for a module, rather -- than just the exported bindings, in the TypeEnv and compiled code (if -- any)? In interpreted mode we do this, so that GHCi can call functions -- inside a module. In HscNothing mode we also do it, so that Haddock can -- get access to the GlobalRdrEnv for a module after typechecking it. targetRetainsAllBindings :: HscTarget -> Bool -- | Will this target result in an object file on the disk? isObjectTarget :: HscTarget -> Bool versionedFilePath :: DynFlags -> FilePath -- | The directory for this version of ghc in the user's app directory -- (typically something like ~.ghcx86_64-linux-7.6.3) versionedAppDir :: DynFlags -> MaybeT IO FilePath tablesNextToCode :: DynFlags -> Bool opt_i :: DynFlags -> [String] opt_lc :: DynFlags -> [String] opt_lo :: DynFlags -> [String] opt_lcc :: DynFlags -> [String] opt_windres :: DynFlags -> [String] opt_lm :: DynFlags -> [String] opt_l :: DynFlags -> [String] opt_a :: DynFlags -> [String] opt_cxx :: DynFlags -> [String] opt_c :: DynFlags -> [String] opt_F :: DynFlags -> [String] opt_P_signature :: DynFlags -> ([String], Fingerprint) opt_P :: DynFlags -> [String] opt_L :: DynFlags -> [String] pgm_i :: DynFlags -> String pgm_lc :: DynFlags -> (String, [Option]) pgm_lo :: DynFlags -> (String, [Option]) pgm_ranlib :: DynFlags -> String pgm_ar :: DynFlags -> String pgm_lcc :: DynFlags -> (String, [Option]) pgm_libtool :: DynFlags -> String pgm_windres :: DynFlags -> String pgm_T :: DynFlags -> String pgm_dll :: DynFlags -> (String, [Option]) pgm_lm :: DynFlags -> (String, [Option]) pgm_l :: DynFlags -> (String, [Option]) pgm_a :: DynFlags -> (String, [Option]) pgm_c :: DynFlags -> String pgm_F :: DynFlags -> String pgm_P :: DynFlags -> (String, [Option]) pgm_L :: DynFlags -> String systemPackageConfig :: DynFlags -> FilePath extraGccViaCFlags :: DynFlags -> [String] tmpDir :: DynFlags -> String topDir :: DynFlags -> FilePath ghciUsagePath :: DynFlags -> FilePath ghcUsagePath :: DynFlags -> FilePath projectVersion :: DynFlags -> String programName :: DynFlags -> String -- | "unbuild" a Settings from a DynFlags. This shouldn't be -- needed in the vast majority of code. But GHCi questionably uses this -- to produce a default DynFlags from which to compute a flags -- diff for printing. settings :: DynFlags -> Settings backendMaintainsCfg :: DynFlags -> Bool -- | Concatenate and flatten the list of global and quoted includes -- returning just a flat list of paths. flattenIncludes :: IncludeSpecs -> [String] -- | Append to the list of includes a path that shall be included using -- `-iquote` when the C compiler is called. These paths only apply when -- quoted includes are used. e.g. #include "foo.h" addQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs -- | Append to the list of includes a path that shall be included using -- `-I` when the C compiler is called. These paths override system search -- paths. addGlobalInclude :: IncludeSpecs -> [String] -> IncludeSpecs optimisationFlags :: EnumSet GeneralFlag -- | Used when outputting warnings: if a reason is given, it is displayed. -- If a warning isn't controlled by a flag, this is made explicit at the -- point of use. data WarnReason NoReason :: WarnReason -- | Warning was enabled with the flag Reason :: !WarningFlag -> WarnReason -- | Warning was made an error because of -Werror or -Werror=WarningFlag ErrReason :: !Maybe WarningFlag -> WarnReason -- | Used to differentiate the scope an include needs to apply to. We have -- to split the include paths to avoid accidentally forcing recursive -- includes since -I overrides the system search paths. See #14312. data IncludeSpecs IncludeSpecs :: [String] -> [String] -> IncludeSpecs [includePathsQuote] :: IncludeSpecs -> [String] [includePathsGlobal] :: IncludeSpecs -> [String] data WarningFlag Opt_WarnDuplicateExports :: WarningFlag Opt_WarnDuplicateConstraints :: WarningFlag Opt_WarnRedundantConstraints :: WarningFlag Opt_WarnHiShadows :: WarningFlag Opt_WarnImplicitPrelude :: WarningFlag Opt_WarnIncompletePatterns :: WarningFlag Opt_WarnIncompleteUniPatterns :: WarningFlag Opt_WarnIncompletePatternsRecUpd :: WarningFlag Opt_WarnOverflowedLiterals :: WarningFlag Opt_WarnEmptyEnumerations :: WarningFlag Opt_WarnMissingFields :: WarningFlag Opt_WarnMissingImportList :: WarningFlag Opt_WarnMissingMethods :: WarningFlag Opt_WarnMissingSignatures :: WarningFlag Opt_WarnMissingLocalSignatures :: WarningFlag Opt_WarnNameShadowing :: WarningFlag Opt_WarnOverlappingPatterns :: WarningFlag Opt_WarnTypeDefaults :: WarningFlag Opt_WarnMonomorphism :: WarningFlag Opt_WarnUnusedTopBinds :: WarningFlag Opt_WarnUnusedLocalBinds :: WarningFlag Opt_WarnUnusedPatternBinds :: WarningFlag Opt_WarnUnusedImports :: WarningFlag Opt_WarnUnusedMatches :: WarningFlag Opt_WarnUnusedTypePatterns :: WarningFlag Opt_WarnUnusedForalls :: WarningFlag Opt_WarnUnusedRecordWildcards :: WarningFlag Opt_WarnRedundantRecordWildcards :: WarningFlag Opt_WarnWarningsDeprecations :: WarningFlag Opt_WarnDeprecatedFlags :: WarningFlag Opt_WarnMissingMonadFailInstances :: WarningFlag Opt_WarnSemigroup :: WarningFlag Opt_WarnDodgyExports :: WarningFlag Opt_WarnDodgyImports :: WarningFlag Opt_WarnOrphans :: WarningFlag Opt_WarnAutoOrphans :: WarningFlag Opt_WarnIdentities :: WarningFlag Opt_WarnTabs :: WarningFlag Opt_WarnUnrecognisedPragmas :: WarningFlag Opt_WarnDodgyForeignImports :: WarningFlag Opt_WarnUnusedDoBind :: WarningFlag Opt_WarnWrongDoBind :: WarningFlag Opt_WarnAlternativeLayoutRuleTransitional :: WarningFlag Opt_WarnUnsafe :: WarningFlag Opt_WarnSafe :: WarningFlag Opt_WarnTrustworthySafe :: WarningFlag Opt_WarnMissedSpecs :: WarningFlag Opt_WarnAllMissedSpecs :: WarningFlag Opt_WarnUnsupportedCallingConventions :: WarningFlag Opt_WarnUnsupportedLlvmVersion :: WarningFlag Opt_WarnMissedExtraSharedLib :: WarningFlag Opt_WarnInlineRuleShadowing :: WarningFlag Opt_WarnTypedHoles :: WarningFlag Opt_WarnPartialTypeSignatures :: WarningFlag Opt_WarnMissingExportedSignatures :: WarningFlag Opt_WarnUntickedPromotedConstructors :: WarningFlag Opt_WarnDerivingTypeable :: WarningFlag Opt_WarnDeferredTypeErrors :: WarningFlag Opt_WarnDeferredOutOfScopeVariables :: WarningFlag Opt_WarnNonCanonicalMonadInstances :: WarningFlag Opt_WarnNonCanonicalMonadFailInstances :: WarningFlag Opt_WarnNonCanonicalMonoidInstances :: WarningFlag Opt_WarnMissingPatternSynonymSignatures :: WarningFlag Opt_WarnUnrecognisedWarningFlags :: WarningFlag Opt_WarnSimplifiableClassConstraints :: WarningFlag Opt_WarnCPPUndef :: WarningFlag Opt_WarnUnbangedStrictPatterns :: WarningFlag Opt_WarnMissingHomeModules :: WarningFlag Opt_WarnPartialFields :: WarningFlag Opt_WarnMissingExportList :: WarningFlag Opt_WarnInaccessibleCode :: WarningFlag Opt_WarnStarIsType :: WarningFlag Opt_WarnStarBinder :: WarningFlag Opt_WarnImplicitKindVars :: WarningFlag Opt_WarnSpaceAfterBang :: WarningFlag Opt_WarnMissingDerivingStrategies :: WarningFlag Opt_WarnPrepositiveQualifiedModule :: WarningFlag Opt_WarnUnusedPackages :: WarningFlag Opt_WarnInferredSafeImports :: WarningFlag Opt_WarnMissingSafeHaskellMode :: WarningFlag Opt_WarnCompatUnqualifiedImports :: WarningFlag Opt_WarnDerivingDefaults :: WarningFlag data Language Haskell98 :: Language Haskell2010 :: Language -- | The various Safe Haskell modes data SafeHaskellMode -- | inferred unsafe Sf_None :: SafeHaskellMode -- | declared and checked Sf_Unsafe :: SafeHaskellMode -- | declared and checked Sf_Trustworthy :: SafeHaskellMode -- | declared and checked Sf_Safe :: SafeHaskellMode -- | inferred as safe Sf_SafeInferred :: SafeHaskellMode -- | -fno-safe-haskell state Sf_Ignore :: SafeHaskellMode -- | Edge weights to use when generating a CFG from CMM data CfgWeights CFGWeights :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> CfgWeights [uncondWeight] :: CfgWeights -> Int [condBranchWeight] :: CfgWeights -> Int [switchWeight] :: CfgWeights -> Int [callWeight] :: CfgWeights -> Int [likelyCondWeight] :: CfgWeights -> Int [unlikelyCondWeight] :: CfgWeights -> Int [infoTablePenalty] :: CfgWeights -> Int [backEdgeBonus] :: CfgWeights -> Int class HasDynFlags (m :: Type -> Type) getDynFlags :: HasDynFlags m => m DynFlags class ContainsDynFlags t extractDynFlags :: ContainsDynFlags t => t -> DynFlags data ProfAuto -- | no SCC annotations added NoProfAuto :: ProfAuto -- | top-level and nested functions are annotated ProfAutoAll :: ProfAuto -- | top-level functions annotated only ProfAutoTop :: ProfAuto -- | exported functions annotated only ProfAutoExports :: ProfAuto -- | annotate call-sites ProfAutoCalls :: ProfAuto data LlvmTarget LlvmTarget :: String -> String -> [String] -> LlvmTarget [lDataLayout] :: LlvmTarget -> String [lCPU] :: LlvmTarget -> String [lAttributes] :: LlvmTarget -> [String] -- | See Note [LLVM Configuration] in SysTools. data LlvmConfig LlvmConfig :: [(String, LlvmTarget)] -> [(Int, String)] -> LlvmConfig [llvmTargets] :: LlvmConfig -> [(String, LlvmTarget)] [llvmPasses] :: LlvmConfig -> [(Int, String)] -- | The target code type of the compilation (if any). -- -- Whenever you change the target, also make sure to set ghcLink -- to something sensible. -- -- HscNothing can be used to avoid generating any output, however, -- note that: -- -- data HscTarget -- | Generate C code. HscC :: HscTarget -- | Generate assembly using the native code generator. HscAsm :: HscTarget -- | Generate assembly using the llvm code generator. HscLlvm :: HscTarget -- | Generate bytecode. (Requires LinkInMemory) HscInterpreted :: HscTarget -- | Don't generate any code. See notes above. HscNothing :: HscTarget -- | The GhcMode tells us whether we're doing multi-module -- compilation (controlled via the GHC API) or one-shot -- (single-module) compilation. This makes a difference primarily to the -- Finder: in one-shot mode we look for interface files for -- imported modules, but in multi-module mode we look for source files in -- order to check whether they need to be recompiled. data GhcMode -- | --make, GHCi, etc. CompManager :: GhcMode -- |
--   ghc -c Foo.hs
--   
OneShot :: GhcMode -- | ghc -M, see Finder for why we need this MkDepend :: GhcMode -- | What to do in the link step, if there is one. data GhcLink -- | Don't link at all NoLink :: GhcLink -- | Link object code into a binary LinkBinary :: GhcLink -- | Use the in-memory dynamic linker (works for both bytecode and object -- code). LinkInMemory :: GhcLink -- | Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms) LinkDynLib :: GhcLink -- | Link objects into a static lib LinkStaticLib :: GhcLink -- | We accept flags which make packages visible, but how they select the -- package varies; this data type reflects what selection criterion is -- used. data PackageArg -- | -package, by PackageName PackageArg :: String -> PackageArg -- | -package-id, by UnitId UnitIdArg :: UnitId -> PackageArg -- | Represents the renaming that may be associated with an exposed -- package, e.g. the rns part of -package "foo (rns)". -- -- Here are some example parsings of the package flags (where a string -- literal is punned to be a ModuleName: -- -- data ModRenaming ModRenaming :: Bool -> [(ModuleName, ModuleName)] -> ModRenaming -- | Bring all exposed modules into scope? [modRenamingWithImplicit] :: ModRenaming -> Bool -- | Bring module m into scope under name n. [modRenamings] :: ModRenaming -> [(ModuleName, ModuleName)] -- | Flags for manipulating the set of non-broken packages. newtype IgnorePackageFlag -- |
--   -ignore-package
--   
IgnorePackage :: String -> IgnorePackageFlag -- | Flags for manipulating package trust. data TrustFlag -- |
--   -trust
--   
TrustPackage :: String -> TrustFlag -- |
--   -distrust
--   
DistrustPackage :: String -> TrustFlag -- | Flags for manipulating packages visibility. data PackageFlag -- | -package, -package-id ExposePackage :: String -> PackageArg -> ModRenaming -> PackageFlag -- |
--   -hide-package
--   
HidePackage :: String -> PackageFlag data PackageDBFlag PackageDB :: PkgConfRef -> PackageDBFlag NoUserPackageDB :: PackageDBFlag NoGlobalPackageDB :: PackageDBFlag ClearPackageDBs :: PackageDBFlag data DynLibLoader Deployable :: DynLibLoader SystemDependent :: DynLibLoader data RtsOptsEnabled RtsOptsNone :: RtsOptsEnabled RtsOptsIgnore :: RtsOptsEnabled RtsOptsIgnoreAll :: RtsOptsEnabled RtsOptsSafeOnly :: RtsOptsEnabled RtsOptsAll :: RtsOptsEnabled data Way WayCustom :: String -> Way WayThreaded :: Way WayDebug :: Way WayProf :: Way WayEventLog :: Way WayDyn :: Way type FatalMessager = String -> IO () type LogAction = DynFlags -> WarnReason -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO () newtype FlushOut FlushOut :: IO () -> FlushOut newtype FlushErr FlushErr :: IO () -> FlushErr data FlagSpec flag FlagSpec :: String -> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag -- | Flag in string form [flagSpecName] :: FlagSpec flag -> String -- | Flag in internal form [flagSpecFlag] :: FlagSpec flag -> flag -- | Extra action to run when the flag is found Typically, emit a warning -- or error [flagSpecAction] :: FlagSpec flag -> TurnOnFlag -> DynP () -- | In which ghc mode the flag has effect [flagSpecGhcMode] :: FlagSpec flag -> GhcFlagMode data PkgConfRef GlobalPkgConf :: PkgConfRef UserPkgConf :: PkgConfRef PkgConfFile :: FilePath -> PkgConfRef data LinkerInfo GnuLD :: [Option] -> LinkerInfo GnuGold :: [Option] -> LinkerInfo LlvmLLD :: [Option] -> LinkerInfo DarwinLD :: [Option] -> LinkerInfo SolarisLD :: [Option] -> LinkerInfo AixLD :: [Option] -> LinkerInfo UnknownLD :: LinkerInfo data CompilerInfo GCC :: CompilerInfo Clang :: CompilerInfo AppleClang :: CompilerInfo AppleClang51 :: CompilerInfo UnknownCC :: CompilerInfo -- | A collection of files that must be deleted before ghc exits. The -- current collection is stored in an IORef in DynFlags, -- filesToClean. data FilesToClean FilesToClean :: !Set FilePath -> !Set FilePath -> FilesToClean -- | Files that will be deleted at the end of runGhc(T) [ftcGhcSession] :: FilesToClean -> !Set FilePath -- | Files that will be deleted the next time -- cleanCurrentModuleTempFiles is called, or otherwise at the end -- of the session. [ftcCurrentModule] :: FilesToClean -> !Set FilePath isHsigFile :: HscSource -> Bool isHsBootOrSig :: HscSource -> Bool hscSourceString :: HscSource -> String data HscSource HsSrcFile :: HscSource HsBootFile :: HscSource HsigFile :: HscSource data Phase unitModuleSet :: Module -> ModuleSet unionModuleSet :: ModuleSet -> ModuleSet -> ModuleSet delModuleSet :: ModuleSet -> Module -> ModuleSet minusModuleSet :: ModuleSet -> ModuleSet -> ModuleSet intersectModuleSet :: ModuleSet -> ModuleSet -> ModuleSet elemModuleSet :: Module -> ModuleSet -> Bool moduleSetElts :: ModuleSet -> [Module] emptyModuleSet :: ModuleSet extendModuleSetList :: ModuleSet -> [Module] -> ModuleSet extendModuleSet :: ModuleSet -> Module -> ModuleSet mkModuleSet :: [Module] -> ModuleSet isEmptyModuleEnv :: ModuleEnv a -> Bool unitModuleEnv :: Module -> a -> ModuleEnv a moduleEnvToList :: ModuleEnv a -> [(Module, a)] moduleEnvElts :: ModuleEnv a -> [a] moduleEnvKeys :: ModuleEnv a -> [Module] emptyModuleEnv :: ModuleEnv a mkModuleEnv :: [(Module, a)] -> ModuleEnv a mapModuleEnv :: (a -> b) -> ModuleEnv a -> ModuleEnv b lookupWithDefaultModuleEnv :: ModuleEnv a -> a -> Module -> a lookupModuleEnv :: ModuleEnv a -> Module -> Maybe a plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a delModuleEnv :: ModuleEnv a -> Module -> ModuleEnv a delModuleEnvList :: ModuleEnv a -> [Module] -> ModuleEnv a plusModuleEnv_C :: (a -> a -> a) -> ModuleEnv a -> ModuleEnv a -> ModuleEnv a extendModuleEnvList_C :: (a -> a -> a) -> ModuleEnv a -> [(Module, a)] -> ModuleEnv a extendModuleEnvList :: ModuleEnv a -> [(Module, a)] -> ModuleEnv a extendModuleEnvWith :: (a -> a -> a) -> ModuleEnv a -> Module -> a -> ModuleEnv a extendModuleEnv :: ModuleEnv a -> Module -> a -> ModuleEnv a elemModuleEnv :: Module -> ModuleEnv a -> Bool filterModuleEnv :: (Module -> a -> Bool) -> ModuleEnv a -> ModuleEnv a wiredInUnitIds :: [UnitId] isHoleModule :: Module -> Bool isInteractiveModule :: Module -> Bool -- | This is the package Id for the current program. It is the default -- package Id if you don't specify a package name. We don't add this -- prefix to symbol names, since there can be only one main package per -- program. mainUnitId :: UnitId interactiveUnitId :: UnitId thisGhcUnitId :: UnitId thUnitId :: UnitId rtsUnitId :: UnitId baseUnitId :: UnitId integerUnitId :: UnitId primUnitId :: UnitId parseModSubst :: ReadP [(ModuleName, Module)] parseModuleId :: ReadP Module parseComponentId :: ReadP ComponentId parseUnitId :: ReadP UnitId parseModuleName :: ReadP ModuleName generalizeIndefModule :: IndefModule -> IndefModule generalizeIndefUnitId :: IndefUnitId -> IndefUnitId -- | See splitModuleInsts. splitUnitIdInsts :: UnitId -> (InstalledUnitId, Maybe IndefUnitId) -- | Given a possibly on-the-fly instantiated module, split it into a -- Module that we definitely can find on-disk, as well as an -- instantiation if we need to instantiate it on the fly. If the -- instantiation is Nothing no on-the-fly renaming is needed. splitModuleInsts :: Module -> (InstalledModule, Maybe IndefModule) -- | Like 'renameHoleUnitId, but requires only PackageConfigMap so -- it can be used by Packages. renameHoleUnitId' :: PackageConfigMap -> ShHoleSubst -> UnitId -> UnitId -- | Like renameHoleModule, but requires only -- PackageConfigMap so it can be used by Packages. renameHoleModule' :: PackageConfigMap -> ShHoleSubst -> Module -> Module -- | Substitutes holes in a UnitId, suitable for renaming when an -- include occurs; see Note [Representation of module/name variable]. -- -- p[A=A] maps to p[A=B] with -- A=B. renameHoleUnitId :: DynFlags -> ShHoleSubst -> UnitId -> UnitId -- | Substitutes holes in a Module. NOT suitable for being called -- directly on a nameModule, see Note [Representation of -- module/name variable]. p[A=A]:B maps to -- p[A=q():A]:B with A=q():A; similarly, -- A maps to q():A. renameHoleModule :: DynFlags -> ShHoleSubst -> Module -> Module stringToUnitId :: String -> UnitId -- | Create a new simple unit identifier from a FastString. -- Internally, this is primarily used to specify wired-in unit -- identifiers. fsToUnitId :: FastString -> UnitId -- | Create a new simple unit identifier (no holes) from a -- ComponentId. newSimpleUnitId :: ComponentId -> UnitId -- | Compares package ids lexically, rather than by their Uniques stableUnitIdCmp :: UnitId -> UnitId -> Ordering -- | Create a new, un-hashed unit identifier. newUnitId :: ComponentId -> [(ModuleName, Module)] -> UnitId -- | Generate a uniquely identifying FastString for a unit -- identifier. This is a one-way function. You can rely on one special -- property: if a unit identifier is in most general form, its -- FastString coincides with its ComponentId. This hash is -- completely internal to GHC and is not used for symbol names or file -- paths. hashUnitId :: ComponentId -> [(ModuleName, Module)] -> FastString -- | A UnitId is definite if it has no free holes. unitIdIsDefinite :: UnitId -> Bool -- | Retrieve the set of free holes of a UnitId. unitIdFreeHoles :: UnitId -> UniqDSet ModuleName delInstalledModuleEnv :: InstalledModuleEnv a -> InstalledModule -> InstalledModuleEnv a filterInstalledModuleEnv :: (InstalledModule -> a -> Bool) -> InstalledModuleEnv a -> InstalledModuleEnv a extendInstalledModuleEnv :: InstalledModuleEnv a -> InstalledModule -> a -> InstalledModuleEnv a lookupInstalledModuleEnv :: InstalledModuleEnv a -> InstalledModule -> Maybe a emptyInstalledModuleEnv :: InstalledModuleEnv a -- | Test if a UnitId corresponds to a given InstalledUnitId, -- modulo instantiation. installedUnitIdEq :: InstalledUnitId -> UnitId -> Bool -- | Test if a Module corresponds to a given InstalledModule, -- modulo instantiation. installedModuleEq :: InstalledModule -> Module -> Bool stringToInstalledUnitId :: String -> InstalledUnitId componentIdToInstalledUnitId :: ComponentId -> InstalledUnitId fsToInstalledUnitId :: FastString -> InstalledUnitId installedUnitIdString :: InstalledUnitId -> String -- | Lossy conversion to the on-disk InstalledUnitId for a -- component. toInstalledUnitId :: UnitId -> InstalledUnitId -- | Injects an IndefModule to Module (see also -- indefUnitIdToUnitId. indefModuleToModule :: DynFlags -> IndefModule -> Module -- | Injects an IndefUnitId (indefinite library which was on-the-fly -- instantiated) to a UnitId (either an indefinite or definite -- library). indefUnitIdToUnitId :: DynFlags -> IndefUnitId -> UnitId -- | Create a new IndefUnitId given an explicit module substitution. newIndefUnitId :: ComponentId -> [(ModuleName, Module)] -> IndefUnitId unitIdKey :: UnitId -> Unique unitIdFS :: UnitId -> FastString pprModule :: Module -> SDoc mkModule :: UnitId -> ModuleName -> Module -- | This gives a stable ordering, as opposed to the Ord instance which -- gives an ordering based on the Uniques of the components, which -- may not be stable from run to run of the compiler. stableModuleCmp :: Module -> Module -> Ordering -- | Create a module variable at some ModuleName. See Note -- [Representation of module/name variables] mkHoleModule :: ModuleName -> Module -- | A Module is definite if it has no free holes. moduleIsDefinite :: Module -> Bool -- | Calculate the free holes of a Module. If this set is non-empty, -- this module was defined in an indefinite library that had required -- signatures. -- -- If a module has free holes, that means that substitutions can operate -- on it; if it has no free holes, substituting over a module has no -- effect. moduleFreeHoles :: Module -> UniqDSet ModuleName -- | Returns the string version of the module name, with dots replaced by -- colons. moduleNameColons :: ModuleName -> String -- | Returns the string version of the module name, with dots replaced by -- slashes. moduleNameSlashes :: ModuleName -> String mkModuleNameFS :: FastString -> ModuleName mkModuleName :: String -> ModuleName -- | Get a string representation of a Module that's unique and -- stable across recompilations. eg. -- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal" moduleStableString :: Module -> String moduleNameString :: ModuleName -> String moduleNameFS :: ModuleName -> FastString pprModuleName :: ModuleName -> SDoc -- | Compares module names lexically, rather than by their Uniques stableModuleNameCmp :: ModuleName -> ModuleName -> Ordering -- | Add the -boot suffix to all output file paths associated with -- the module, not including the input file itself addBootSuffixLocnOut :: ModLocation -> ModLocation -- | Add the -boot suffix to all file paths associated with the -- module addBootSuffixLocn :: ModLocation -> ModLocation -- | Add the -boot suffix if the Bool argument is -- True addBootSuffix_maybe :: Bool -> FilePath -> FilePath -- | Add the -boot suffix to .hs, .hi and .o files addBootSuffix :: FilePath -> FilePath -- | Module Location -- -- Where a module lives on the file system: the actual locations of the -- .hs, .hi and .o files, if we have them data ModLocation ModLocation :: Maybe FilePath -> FilePath -> FilePath -> FilePath -> ModLocation [ml_hs_file] :: ModLocation -> Maybe FilePath [ml_hi_file] :: ModLocation -> FilePath [ml_obj_file] :: ModLocation -> FilePath [ml_hie_file] :: ModLocation -> FilePath class ContainsModule t extractModule :: ContainsModule t => t -> Module class HasModule (m :: Type -> Type) getModule :: HasModule m => m Module -- | A unit identifier which identifies an indefinite library (with holes) -- that has been *on-the-fly* instantiated with a substitution -- indefUnitIdInsts. In fact, an indefinite unit identifier could -- have no holes, but we haven't gotten around to compiling the actual -- library yet. -- -- An indefinite unit identifier pretty-prints to something like -- p[H=H,A=aimpl:A>] (p is the -- ComponentId, and the brackets enclose the module substitution). data IndefUnitId IndefUnitId :: FastString -> Unique -> !ComponentId -> ![(ModuleName, Module)] -> UniqDSet ModuleName -> IndefUnitId -- | A private, uniquely identifying representation of a UnitId. This -- string is completely private to GHC and is just used to get a unique; -- in particular, we don't use it for symbols (indefinite libraries are -- not compiled). [indefUnitIdFS] :: IndefUnitId -> FastString -- | Cached unique of unitIdFS. [indefUnitIdKey] :: IndefUnitId -> Unique -- | The component identity of the indefinite library that is being -- instantiated. [indefUnitIdComponentId] :: IndefUnitId -> !ComponentId -- | The sorted (by ModuleName) instantiations of this library. [indefUnitIdInsts] :: IndefUnitId -> ![(ModuleName, Module)] -- | A cache of the free module variables of unitIdInsts. This -- lets us efficiently tell if a UnitId has been fully -- instantiated (free module variables are empty) and whether or not a -- substitution can have any effect. [indefUnitIdFreeHoles] :: IndefUnitId -> UniqDSet ModuleName data IndefModule IndefModule :: IndefUnitId -> ModuleName -> IndefModule [indefModuleUnitId] :: IndefModule -> IndefUnitId [indefModuleName] :: IndefModule -> ModuleName -- | A InstalledModule is a Module which contains a -- InstalledUnitId. data InstalledModule InstalledModule :: !InstalledUnitId -> !ModuleName -> InstalledModule [installedModuleUnitId] :: InstalledModule -> !InstalledUnitId [installedModuleName] :: InstalledModule -> !ModuleName -- | A DefUnitId is an InstalledUnitId with the invariant -- that it only refers to a definite library; i.e., one we have generated -- code for. newtype DefUnitId DefUnitId :: InstalledUnitId -> DefUnitId [unDefUnitId] :: DefUnitId -> InstalledUnitId -- | A map keyed off of InstalledModule data InstalledModuleEnv elt -- | Substitution on module variables, mapping module names to module -- identifiers. type ShHoleSubst = ModuleNameEnv Module -- | A map keyed off of Modules data ModuleEnv elt -- | A set of Modules type ModuleSet = Set NDModule -- | A map keyed off of ModuleNames (actually, their Uniques) type ModuleNameEnv elt = UniqFM elt -- | A map keyed off of ModuleNames (actually, their Uniques) -- Has deterministic folds and can be deterministically converted to a -- list type DModuleNameEnv elt = UniqDFM elt mkFsEnv :: [(FastString, a)] -> FastStringEnv a lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a emptyFsEnv :: FastStringEnv a -- | A non-deterministic set of FastStrings. See Note [Deterministic -- UniqFM] in UniqDFM for explanation why it's not deterministic and why -- it matters. Use DFastStringEnv if the set eventually gets converted -- into a list or folded over in a way where the order changes the -- generated code. type FastStringEnv a = UniqFM a initExitJoinUnique :: Unique mkTcOccUnique :: FastString -> Unique mkTvOccUnique :: FastString -> Unique mkDataOccUnique :: FastString -> Unique mkVarOccUnique :: FastString -> Unique mkCostCentreUnique :: Int -> Unique mkRegClassUnique :: Int -> Unique mkRegPairUnique :: Int -> Unique mkRegSubUnique :: Int -> Unique mkRegSingleUnique :: Int -> Unique mkPseudoUniqueH :: Int -> Unique mkPseudoUniqueE :: Int -> Unique mkPseudoUniqueD :: Int -> Unique mkBuiltinUnique :: Int -> Unique initTyVarUnique :: Unique mkPreludeMiscIdUnique :: Int -> Unique mkPrimOpWrapperUnique :: Int -> Unique mkPrimOpIdUnique :: Int -> Unique dataConTyRepNameUnique :: Unique -> Unique dataConWorkerUnique :: Unique -> Unique mkPreludeDataConUnique :: Arity -> Unique tyConRepNameUnique :: Unique -> Unique mkPreludeTyConUnique :: Int -> Unique mkPreludeClassUnique :: Int -> Unique mkCoVarUnique :: Int -> Unique mkAlphaTyVarUnique :: Int -> Unique pprUniqueAlways :: Unique -> SDoc nonDetCmpUnique :: Unique -> Unique -> Ordering ltUnique :: Unique -> Unique -> Bool eqUnique :: Unique -> Unique -> Bool hasKey :: Uniquable a => a -> Unique -> Bool -- | The interface file symbol-table encoding assumes that known-key -- uniques fit in 30-bits; verify this. -- -- See Note [Symbol table representation of names] in BinIface for -- details. isValidKnownKeyUnique :: Unique -> Bool unpkUnique :: Unique -> (Char, Int) mkUnique :: Char -> Int -> Unique newTagUnique :: Unique -> Char -> Unique deriveUnique :: Unique -> Int -> Unique getKey :: Unique -> Int mkUniqueGrimily :: Int -> Unique uNIQUE_BITS :: Int -- | Unique identifier. -- -- The type of unique identifiers that are used in many places in GHC for -- fast ordering and equality tests. You should generate these with the -- functions from the UniqSupply module -- -- These are sometimes also referred to as "keys" in comments in GHC. data Unique -- | Class of things that we can obtain a Unique from class Uniquable a getUnique :: Uniquable a => a -> Unique isKindLevel :: TypeOrKind -> Bool isTypeLevel :: TypeOrKind -> Bool -- | Inject any integer into an IntWithInf mkIntWithInf :: Int -> IntWithInf -- | Turn a positive number into an IntWithInf, where 0 represents -- infinity treatZeroAsInf :: Int -> IntWithInf intGtLimit :: Int -> IntWithInf -> Bool -- | A representation of infinity infinity :: IntWithInf integralFractionalLit :: Bool -> Integer -> FractionalLit negateFractionalLit :: FractionalLit -> FractionalLit mkFractionalLit :: Real a => a -> FractionalLit negateIntegralLit :: IntegralLit -> IntegralLit mkIntegralLit :: Integral a => a -> IntegralLit isEarlyActive :: Activation -> Bool isAlwaysActive :: Activation -> Bool isNeverActive :: Activation -> Bool competesWith :: Activation -> Activation -> Bool isActiveIn :: PhaseNum -> Activation -> Bool isActive :: CompilerPhase -> Activation -> Bool pprInlineDebug :: InlinePragma -> SDoc pprInline :: InlinePragma -> SDoc setInlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo -> InlinePragma setInlinePragmaActivation :: InlinePragma -> Activation -> InlinePragma inlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo inlinePragmaActivation :: InlinePragma -> Activation inlinePragmaSat :: InlinePragma -> Maybe Arity isAnyInlinePragma :: InlinePragma -> Bool isInlinablePragma :: InlinePragma -> Bool isInlinePragma :: InlinePragma -> Bool isDefaultInlinePragma :: InlinePragma -> Bool dfunInlinePragma :: InlinePragma inlinePragmaSpec :: InlinePragma -> InlineSpec neverInlinePragma :: InlinePragma alwaysInlinePragma :: InlinePragma defaultInlinePragma :: InlinePragma noUserInlineSpec :: InlineSpec -> Bool isFunLike :: RuleMatchInfo -> Bool isConLike :: RuleMatchInfo -> Bool activeDuringFinal :: Activation activeAfterInitial :: Activation -- | Special combinator for showing string literals. pprWithSourceText :: SourceText -> SDoc -> SDoc failed :: SuccessFlag -> Bool succeeded :: SuccessFlag -> Bool successIf :: Bool -> SuccessFlag zapFragileOcc :: OccInfo -> OccInfo isOneOcc :: OccInfo -> Bool isDeadOcc :: OccInfo -> Bool isStrongLoopBreaker :: OccInfo -> Bool isWeakLoopBreaker :: OccInfo -> Bool weakLoopBreaker :: OccInfo strongLoopBreaker :: OccInfo isAlwaysTailCalled :: OccInfo -> Bool zapOccTailCallInfo :: OccInfo -> OccInfo tailCallInfo :: OccInfo -> TailCallInfo notOneBranch :: OneBranch oneBranch :: OneBranch notInsideLam :: InsideLam insideLam :: InsideLam seqOccInfo :: OccInfo -> () isManyOccs :: OccInfo -> Bool noOccInfo :: OccInfo -- | Pretty print an alternative in an unboxed sum e.g. "| a | |". pprAlternative :: (a -> SDoc) -> a -> ConTag -> Arity -> SDoc sumParens :: SDoc -> SDoc tupleParens :: TupleSort -> SDoc -> SDoc boxityTupleSort :: Boxity -> TupleSort tupleSortBoxity :: TupleSort -> Boxity maybeParen :: PprPrec -> PprPrec -> SDoc -> SDoc appPrec :: PprPrec opPrec :: PprPrec funPrec :: PprPrec sigPrec :: PprPrec topPrec :: PprPrec hasOverlappingFlag :: OverlapMode -> Bool hasOverlappableFlag :: OverlapMode -> Bool hasIncoherentFlag :: OverlapMode -> Bool setOverlapModeMaybe :: OverlapFlag -> Maybe OverlapMode -> OverlapFlag isGenerated :: Origin -> Bool boolToRecFlag :: Bool -> RecFlag isNonRec :: RecFlag -> Bool isRec :: RecFlag -> Bool isBoxed :: Boxity -> Bool isTopLevel :: TopLevelFlag -> Bool isNotTopLevel :: TopLevelFlag -> Bool compareFixity :: Fixity -> Fixity -> (Bool, Bool) funTyFixity :: Fixity negateFixity :: Fixity defaultFixity :: Fixity minPrecedence :: Int maxPrecedence :: Int pprRuleName :: RuleName -> SDoc pprWarningTxtForMsg :: WarningTxt -> SDoc initialVersion :: Version bumpVersion :: Version -> Version isPromoted :: PromotionFlag -> Bool unSwap :: SwapFlag -> (a -> a -> b) -> a -> a -> b isSwapped :: SwapFlag -> Bool flipSwap :: SwapFlag -> SwapFlag bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo worstOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo hasNoOneShotInfo :: OneShotInfo -> Bool isOneShotInfo :: OneShotInfo -> Bool -- | It is always safe to assume that an Id has no lambda-bound -- variable information noOneShotInfo :: OneShotInfo alignmentOf :: Int -> Alignment mkAlignment :: Int -> Alignment -- | Tags are allocated from here for real constructors or for superclass -- selectors fIRST_TAG :: ConTag pickLR :: LeftOrRight -> (a, a) -> a data LeftOrRight CLeft :: LeftOrRight CRight :: LeftOrRight -- | The number of value arguments that can be applied to a value before it -- does "real work". So: fib 100 has arity 0 x -> fib x has arity 1 -- See also Note [Definition of arity] in CoreArity type Arity = Int -- | Representation Arity -- -- The number of represented arguments that can be applied to a value -- before it does "real work". So: fib 100 has representation arity 0 x -- -> fib x has representation arity 1 () -> fib (x + y) has -- representation arity 2 type RepArity = Int -- | The number of arguments that a join point takes. Unlike the arity of a -- function, this is a purely syntactic property and is fixed when the -- join point is created (or converted from a value). Both type and value -- arguments are counted. type JoinArity = Int -- | Constructor Tag -- -- Type of the tags associated with each constructor possibility or -- superclass selector type ConTag = Int -- | A *zero-indexed* constructor tag type ConTagZ = Int -- | A power-of-two alignment data Alignment -- | If the Id is a lambda-bound variable then it may have -- lambda-bound variable info. Sometimes we know whether the lambda -- binding this variable is a "one-shot" lambda; that is, whether it is -- applied at most once. -- -- This information may be useful in optimisation, as computations may -- safely be floated inside such a lambda without risk of duplicating -- work. data OneShotInfo -- | No information NoOneShotInfo :: OneShotInfo -- | The lambda is applied at most once. OneShotLam :: OneShotInfo data SwapFlag NotSwapped :: SwapFlag IsSwapped :: SwapFlag -- | Is a TyCon a promoted data constructor or just a normal type -- constructor? data PromotionFlag NotPromoted :: PromotionFlag IsPromoted :: PromotionFlag data FunctionOrData IsFunction :: FunctionOrData IsData :: FunctionOrData type Version = Int -- | A String Literal in the source, including its original raw format for -- use by source to source manipulation tools. data StringLiteral StringLiteral :: SourceText -> FastString -> StringLiteral [sl_st] :: StringLiteral -> SourceText [sl_fs] :: StringLiteral -> FastString -- | Warning Text -- -- reason/explanation from a WARNING or DEPRECATED pragma data WarningTxt WarningTxt :: Located SourceText -> [Located StringLiteral] -> WarningTxt DeprecatedTxt :: Located SourceText -> [Located StringLiteral] -> WarningTxt type RuleName = FastString data Fixity Fixity :: SourceText -> Int -> FixityDirection -> Fixity data FixityDirection InfixL :: FixityDirection InfixR :: FixityDirection InfixN :: FixityDirection -- | Captures the fixity of declarations as they are parsed. This is not -- necessarily the same as the fixity declaration, as the normal fixity -- may be overridden using parens or backticks. data LexicalFixity Prefix :: LexicalFixity Infix :: LexicalFixity data TopLevelFlag TopLevel :: TopLevelFlag NotTopLevel :: TopLevelFlag data Boxity Boxed :: Boxity Unboxed :: Boxity -- | Recursivity Flag data RecFlag Recursive :: RecFlag NonRecursive :: RecFlag data Origin FromSource :: Origin Generated :: Origin -- | The semantics allowed for overlapping instances for a particular -- instance. See Note [Safe Haskell isSafeOverlap] (in hs) for a -- explanation of the isSafeOverlap field. -- -- data OverlapFlag OverlapFlag :: OverlapMode -> Bool -> OverlapFlag [overlapMode] :: OverlapFlag -> OverlapMode [isSafeOverlap] :: OverlapFlag -> Bool data OverlapMode -- | This instance must not overlap another NoOverlap instance. -- However, it may be overlapped by Overlapping instances, and it -- may overlap Overlappable instances. NoOverlap :: SourceText -> OverlapMode -- | Silently ignore this instance if you find a more specific one that -- matches the constraint you are trying to resolve -- -- Example: constraint (Foo [Int]) instance Foo [Int] instance {--} Foo -- [a] -- -- Since the second instance has the Overlappable flag, the first -- instance will be chosen (otherwise its ambiguous which to choose) Overlappable :: SourceText -> OverlapMode -- | Silently ignore any more general instances that may be used to solve -- the constraint. -- -- Example: constraint (Foo [Int]) instance {--} Foo [Int] instance Foo -- [a] -- -- Since the first instance has the Overlapping flag, the second---more -- general---instance will be ignored (otherwise it is ambiguous which to -- choose) Overlapping :: SourceText -> OverlapMode -- | Equivalent to having both Overlapping and Overlappable -- flags. Overlaps :: SourceText -> OverlapMode -- | Behave like Overlappable and Overlapping, and in addition pick an an -- arbitrary one if there are multiple matching candidates, and don't -- worry about later instantiation -- -- Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int] -- instance Foo [a] Without the Incoherent flag, we'd complain that -- instantiating b would change which instance was chosen. See -- also note [Incoherent instances] in InstEnv Incoherent :: SourceText -> OverlapMode -- | A general-purpose pretty-printing precedence type. newtype PprPrec PprPrec :: Int -> PprPrec data TupleSort BoxedTuple :: TupleSort UnboxedTuple :: TupleSort ConstraintTuple :: TupleSort -- | Embedding Projection pair data EP a EP :: a -> a -> EP a [fromEP] :: EP a -> a [toEP] :: EP a -> a -- | identifier Occurrence Information data OccInfo -- | There are many occurrences, or unknown occurrences ManyOccs :: !TailCallInfo -> OccInfo [occ_tail] :: OccInfo -> !TailCallInfo -- | Marks unused variables. Sometimes useful for lambda and case-bound -- variables. IAmDead :: OccInfo -- | Occurs exactly once (per branch), not inside a rule OneOcc :: !InsideLam -> !OneBranch -> !InterestingCxt -> !TailCallInfo -> OccInfo [occ_in_lam] :: OccInfo -> !InsideLam [occ_one_br] :: OccInfo -> !OneBranch [occ_int_cxt] :: OccInfo -> !InterestingCxt [occ_tail] :: OccInfo -> !TailCallInfo -- | This identifier breaks a loop of mutually recursive functions. The -- field marks whether it is only a loop breaker due to a reference in a -- rule IAmALoopBreaker :: !RulesOnly -> !TailCallInfo -> OccInfo [occ_rules_only] :: OccInfo -> !RulesOnly [occ_tail] :: OccInfo -> !TailCallInfo -- | Interesting Context type InterestingCxt = Bool -- | Inside Lambda type InsideLam = Bool type OneBranch = Bool data TailCallInfo AlwaysTailCalled :: JoinArity -> TailCallInfo NoTailCallInfo :: TailCallInfo -- | Default Method Specification data DefMethSpec ty VanillaDM :: DefMethSpec ty GenericDM :: ty -> DefMethSpec ty data SuccessFlag Succeeded :: SuccessFlag Failed :: SuccessFlag data SourceText SourceText :: String -> SourceText -- | For when code is generated, e.g. TH, deriving. The pretty printer will -- then make its own representation of the item. NoSourceText :: SourceText -- | Phase Number type PhaseNum = Int data CompilerPhase Phase :: PhaseNum -> CompilerPhase InitialPhase :: CompilerPhase data Activation NeverActive :: Activation AlwaysActive :: Activation ActiveBefore :: SourceText -> PhaseNum -> Activation ActiveAfter :: SourceText -> PhaseNum -> Activation -- | Rule Match Information data RuleMatchInfo ConLike :: RuleMatchInfo FunLike :: RuleMatchInfo data InlinePragma InlinePragma :: SourceText -> InlineSpec -> Maybe Arity -> Activation -> RuleMatchInfo -> InlinePragma [inl_src] :: InlinePragma -> SourceText [inl_inline] :: InlinePragma -> InlineSpec [inl_sat] :: InlinePragma -> Maybe Arity [inl_act] :: InlinePragma -> Activation [inl_rule] :: InlinePragma -> RuleMatchInfo -- | Inline Specification data InlineSpec Inline :: InlineSpec Inlinable :: InlineSpec NoInline :: InlineSpec NoUserInline :: InlineSpec -- | Integral Literal -- -- Used (instead of Integer) to represent negative zegative zero which is -- required for NegativeLiterals extension to correctly parse -- `-0::Double` as negative zero. See also #13211. data IntegralLit IL :: SourceText -> Bool -> Integer -> IntegralLit [il_text] :: IntegralLit -> SourceText [il_neg] :: IntegralLit -> Bool [il_value] :: IntegralLit -> Integer -- | Fractional Literal -- -- Used (instead of Rational) to represent exactly the floating point -- literal that we encountered in the user's source program. This allows -- us to pretty-print exactly what the user wrote, which is important -- e.g. for floating point numbers that can't represented as Doubles (we -- used to via Double for pretty-printing). See also #2245. data FractionalLit FL :: SourceText -> Bool -> Rational -> FractionalLit [fl_text] :: FractionalLit -> SourceText [fl_neg] :: FractionalLit -> Bool [fl_value] :: FractionalLit -> Rational -- | An integer or infinity data IntWithInf data SpliceExplicitFlag -- | = $(f x y) ExplicitSplice :: SpliceExplicitFlag -- | = f x y, i.e. a naked top level expression ImplicitSplice :: SpliceExplicitFlag -- | Flag to see whether we're type-checking terms or kind-checking types data TypeOrKind TypeLevel :: TypeOrKind KindLevel :: TypeOrKind -- | Make an unannotated error message with location info. mkLocMessage :: Severity -> SrcSpan -> MsgDoc -> MsgDoc -- | Make a possibly annotated error message with location info. mkLocMessageAnn :: Maybe String -> Severity -> SrcSpan -> MsgDoc -> MsgDoc getCaretDiagnostic :: Severity -> SrcSpan -> IO MsgDoc -- | A wrapper around dumpSDocWithStyle which uses PprDump -- style. dumpSDoc :: DynFlags -> PrintUnqualified -> DumpFlag -> String -> SDoc -> IO () data Severity SevOutput :: Severity SevFatal :: Severity SevInteractive :: Severity -- | Log message intended for compiler developers No filelinecolumn -- stuff SevDump :: Severity -- | Log messages intended for end users. No filelinecolumn stuff. SevInfo :: Severity SevWarning :: Severity -- | SevWarning and SevError are used for warnings and errors o The message -- has a filelinecolumn heading, plus "warning:" or "error:", -- added by mkLocMessags o Output is intended for end users SevError :: Severity type MsgDoc = SDoc unRealSrcSpan :: RealLocated a -> a getRealSrcSpan :: RealLocated a -> RealSrcSpan liftL :: (HasSrcSpan a, HasSrcSpan b, Monad m) => (SrcSpanLess a -> m (SrcSpanLess b)) -> a -> m b -- | Lifts a function of undecorated entities to one of decorated ones onHasSrcSpan :: (HasSrcSpan a, HasSrcSpan b) => (SrcSpanLess a -> SrcSpanLess b) -> a -> b -- | An abbreviated form of composeSrcSpan, mainly to replace the hardcoded -- L cL :: HasSrcSpan a => SrcSpan -> SrcSpanLess a -> a -- | An abbreviated form of decomposeSrcSpan, mainly to be used in -- ViewPatterns dL :: HasSrcSpan a => a -> Located (SrcSpanLess a) -- | Determines whether a span is enclosed by another one isSubspanOf :: SrcSpan -> SrcSpan -> Bool -- | Determines whether a span encloses a given line and column index spans :: SrcSpan -> (Int, Int) -> Bool -- | Alternative strategies for ordering SrcSpans leftmost_largest :: SrcSpan -> SrcSpan -> Ordering -- | Alternative strategies for ordering SrcSpans leftmost_smallest :: SrcSpan -> SrcSpan -> Ordering -- | Alternative strategies for ordering SrcSpans rightmost :: SrcSpan -> SrcSpan -> Ordering -- | Tests the ordering of the two located things cmpLocated :: (HasSrcSpan a, Ord (SrcSpanLess a)) => a -> a -> Ordering -- | Tests whether the two located things are equal eqLocated :: (HasSrcSpan a, Eq (SrcSpanLess a)) => a -> a -> Bool -- | Combine locations from two Located things and add them to a -- third thing addCLoc :: (HasSrcSpan a, HasSrcSpan b, HasSrcSpan c) => a -> b -> SrcSpanLess c -> c combineLocs :: (HasSrcSpan a, HasSrcSpan b) => a -> b -> SrcSpan mkGeneralLocated :: HasSrcSpan e => String -> SrcSpanLess e -> e noLoc :: HasSrcSpan a => SrcSpanLess a -> a getLoc :: HasSrcSpan a => a -> SrcSpan unLoc :: HasSrcSpan a => a -> SrcSpanLess a mapLoc :: (a -> b) -> GenLocated l a -> GenLocated l b pprUserRealSpan :: Bool -> RealSrcSpan -> SDoc -- | Obtains the filename for a SrcSpan if it is "good" srcSpanFileName_maybe :: SrcSpan -> Maybe FastString realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc realSrcSpanStart :: RealSrcSpan -> RealSrcLoc -- | Returns the location at the end of the SrcSpan or a "bad" -- SrcSpan if that is unavailable srcSpanEnd :: SrcSpan -> SrcLoc -- | Returns the location at the start of the SrcSpan or a "bad" -- SrcSpan if that is unavailable srcSpanStart :: SrcSpan -> SrcLoc srcSpanEndCol :: RealSrcSpan -> Int srcSpanStartCol :: RealSrcSpan -> Int srcSpanEndLine :: RealSrcSpan -> Int srcSpanStartLine :: RealSrcSpan -> Int -- | Tests whether the first span "contains" the other span, meaning that -- it covers at least as much source code. True where spans are equal. containsSpan :: RealSrcSpan -> RealSrcSpan -> Bool -- | True if the span is known to straddle only one line. For "bad" -- SrcSpan, it returns False isOneLineSpan :: SrcSpan -> Bool -- | Test if a SrcSpan is "good", i.e. has precise location -- information isGoodSrcSpan :: SrcSpan -> Bool -- | Convert a SrcSpan into one that represents only its first character srcSpanFirstCharacter :: SrcSpan -> SrcSpan -- | Combines two SrcSpan into one that spans at least all the -- characters within both spans. Returns UnhelpfulSpan if the files -- differ. combineSrcSpans :: SrcSpan -> SrcSpan -> SrcSpan -- | Create a SrcSpan between two points in a file mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan -- | Create a SrcSpan between two points in a file mkRealSrcSpan :: RealSrcLoc -> RealSrcLoc -> RealSrcSpan realSrcLocSpan :: RealSrcLoc -> RealSrcSpan -- | Create a SrcSpan corresponding to a single point srcLocSpan :: SrcLoc -> SrcSpan -- | Create a "bad" SrcSpan that has not location information mkGeneralSrcSpan :: FastString -> SrcSpan -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty interactiveSrcSpan :: SrcSpan -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty wiredInSrcSpan :: SrcSpan -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty noSrcSpan :: SrcSpan sortLocated :: HasSrcSpan a => [a] -> [a] -- | Move the SrcLoc down by one line if the character is a newline, -- to the next 8-char tabstop if it is a tab, and across by one character -- in any other case advanceSrcLoc :: RealSrcLoc -> Char -> RealSrcLoc -- | Raises an error when used on a "bad" SrcLoc srcLocCol :: RealSrcLoc -> Int -- | Raises an error when used on a "bad" SrcLoc srcLocLine :: RealSrcLoc -> Int -- | Gives the filename of the RealSrcLoc srcLocFile :: RealSrcLoc -> FastString -- | Creates a "bad" SrcLoc that has no detailed information about -- its location mkGeneralSrcLoc :: FastString -> SrcLoc -- | Built-in "bad" SrcLoc values for particular locations interactiveSrcLoc :: SrcLoc -- | Built-in "bad" SrcLoc values for particular locations generatedSrcLoc :: SrcLoc -- | Built-in "bad" SrcLoc values for particular locations noSrcLoc :: SrcLoc mkRealSrcLoc :: FastString -> Int -> Int -> RealSrcLoc mkSrcLoc :: FastString -> Int -> Int -> SrcLoc -- | A Pattern Synonym to Set/Get SrcSpans pattern LL :: HasSrcSpan a => SrcSpan -> SrcSpanLess a -> a -- | Real Source Location -- -- Represents a single point within a file data RealSrcLoc -- | Source Location data SrcLoc RealSrcLoc :: {-# UNPACK #-} !RealSrcLoc -> SrcLoc UnhelpfulLoc :: FastString -> SrcLoc -- | A RealSrcSpan delimits a portion of a text file. It could be -- represented by a pair of (line,column) coordinates, but in fact we -- optimise slightly by using more compact representations for -- single-line and zero-length spans, both of which are quite common. -- -- The end position is defined to be the column after the end of -- the span. That is, a span of (1,1)-(1,2) is one character long, and a -- span of (1,1)-(1,1) is zero characters long. -- -- Real Source Span data RealSrcSpan -- | Source Span -- -- A SrcSpan identifies either a specific portion of a text file -- or a human-readable description of a location. data SrcSpan RealSrcSpan :: !RealSrcSpan -> SrcSpan UnhelpfulSpan :: !FastString -> SrcSpan -- | We attach SrcSpans to lots of things, so let's have a datatype for it. data GenLocated l e L :: l -> e -> GenLocated l e type Located = GenLocated SrcSpan type RealLocated = GenLocated RealSrcSpan -- | Determines the type of undecorated syntactic entities For most -- syntactic entities E, where source location spans are -- introduced by a wrapper construtor of the same syntactic entity, we -- have `SrcSpanLess E = E`. However, some syntactic entities have a -- different type compared to a syntactic entity `e :: E` may have the -- type `Located E` when decorated by wrapping it with `L sp e` for a -- source span sp. type family SrcSpanLess a -- | A typeclass to set/get SrcSpans class HasSrcSpan a -- | Composes a SrcSpan decoration with an undecorated syntactic -- entity to form its decorated variant composeSrcSpan :: HasSrcSpan a => Located (SrcSpanLess a) -> a -- | Decomposes a decorated syntactic entity into its SrcSpan -- decoration and its undecorated variant decomposeSrcSpan :: HasSrcSpan a => a -> Located (SrcSpanLess a) alwaysQualify :: PrintUnqualified -- | When printing code that contains original names, we need to map the -- original names back to something the user understands. This is the -- purpose of the triple of functions that gets passed around when -- rendering SDoc. data PrintUnqualified unitIdString :: UnitId -> String -- | A Module is a pair of a UnitId and a ModuleName. -- -- Module variables (i.e. H) which can be instantiated to -- a specific module at some later point in time are represented with -- moduleUnitId set to holeUnitId (this allows us to avoid -- having to make moduleUnitId a partial operation.) data Module Module :: !UnitId -> !ModuleName -> Module [moduleUnitId] :: Module -> !UnitId [moduleName] :: Module -> !ModuleName -- | A ModuleName is essentially a simple string, e.g. Data.List. data ModuleName -- | A unit identifier identifies a (possibly partially) instantiated -- library. It is primarily used as part of Module, which in turn -- is used in Name, which is used to give names to entities when -- typechecking. -- -- There are two possible forms for a UnitId. It can be a -- DefiniteUnitId, in which case we just have a string that -- uniquely identifies some fully compiled, installed library we have on -- disk. However, when we are typechecking a library with missing holes, -- we may need to instantiate a library on the fly (in which case we -- don't have any on-disk representation.) In that case, you have an -- IndefiniteUnitId, which explicitly records the instantiation, -- so that we can substitute over it. data UnitId IndefiniteUnitId :: {-# UNPACK #-} !IndefUnitId -> UnitId DefiniteUnitId :: {-# UNPACK #-} !DefUnitId -> UnitId -- | An installed unit identifier identifies a library which has been -- installed to the package database. These strings are provided to us -- via the -this-unit-id flag. The library in question may be -- definite or indefinite; if it is indefinite, none of the holes have -- been filled (we never install partially instantiated libraries.) Put -- another way, an installed unit id is either fully instantiated, or not -- instantiated at all. -- -- Installed unit identifiers look something like -- p+af23SAj2dZ219, or maybe just p if they don't use -- Backpack. newtype InstalledUnitId InstalledUnitId :: FastString -> InstalledUnitId -- | The full hashed unit identifier, including the component id and the -- hash. [installedUnitIdFS] :: InstalledUnitId -> FastString -- | A ComponentId consists of the package name, package version, -- component ID, the transitive dependencies of the component, and other -- information to uniquely identify the source code and build -- configuration of a component. -- -- This used to be known as an InstalledPackageId, but a package -- can contain multiple components and a ComponentId uniquely -- identifies a component within a package. When a package only has one -- component, the ComponentId coincides with the -- InstalledPackageId newtype ComponentId ComponentId :: FastString -> ComponentId fsLit :: String -> FastString sLit :: String -> PtrString -- | Return the length of a PtrString lengthPS :: PtrString -> Int -- | Decode a PtrString back into a String using Latin-1 -- encoding. This does not free the memory associated with -- PtrString. unpackPtrString :: PtrString -> String -- | Encode a String into a newly allocated PtrString using -- Latin-1 encoding. The original string must not contain non-Latin-1 -- characters (above codepoint 0xff). mkPtrString :: String -> PtrString -- | Wrap an unboxed address into a PtrString. mkPtrString# :: Addr# -> PtrString -- | Outputs a FastString with no decoding at all, that is, -- you get the actual bytes in the FastString written to the -- Handle. hPutFS :: Handle -> FastString -> IO () getFastStringZEncCounter :: IO Int getFastStringTable :: IO [[[FastString]]] isUnderscoreFS :: FastString -> Bool nilFS :: FastString uniqueOfFS :: FastString -> Int consFS :: Char -> FastString -> FastString tailFS :: FastString -> FastString headFS :: FastString -> Char concatFS :: [FastString] -> FastString appendFS :: FastString -> FastString -> FastString -- | Returns a Z-encoded version of a FastString. This might be the -- original, if it was already Z-encoded. The first time this function is -- applied to a particular FastString, the results are memoized. zEncodeFS :: FastString -> FastZString -- | Unpacks and decodes the FastString unpackFS :: FastString -> String -- | Returns True if the FastString is empty nullFS :: FastString -> Bool -- | Returns the length of the FastString in characters lengthFS :: FastString -> Int -- | Creates a FastString from a UTF-8 encoded [Word8] mkFastStringByteList :: [Word8] -> FastString -- | Creates a UTF-8 encoded FastString from a String mkFastString :: String -> FastString -- | Create a FastString from an existing ForeignPtr; the -- difference between this and mkFastStringBytes is that we don't -- have to copy the bytes if the string is new to the table. mkFastStringByteString :: ByteString -> FastString -- | Create a FastString from an existing ForeignPtr; the -- difference between this and mkFastStringBytes is that we don't -- have to copy the bytes if the string is new to the table. mkFastStringForeignPtr :: Ptr Word8 -> ForeignPtr Word8 -> Int -> IO FastString mkFastStringBytes :: Ptr Word8 -> Int -> FastString mkFastString# :: Addr# -> FastString lengthFZS :: FastZString -> Int zString :: FastZString -> String hPutFZS :: Handle -> FastZString -> IO () unsafeMkByteString :: String -> ByteString fastZStringToByteString :: FastZString -> ByteString fastStringToByteString :: FastString -> ByteString -- | Gives the UTF-8 encoded bytes corresponding to a FastString bytesFS :: FastString -> ByteString data FastZString -- | A FastString is a UTF-8 encoded string together with a unique -- ID. All FastStrings are stored in a global hashtable to support -- fast O(1) comparison. -- -- It is also associated with a lazy reference to the Z-encoding of this -- string which is used by the compiler internally. data FastString FastString :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !ByteString -> FastZString -> FastString [uniq] :: FastString -> {-# UNPACK #-} !Int [n_chars] :: FastString -> {-# UNPACK #-} !Int [fs_bs] :: FastString -> {-# UNPACK #-} !ByteString -- | Lazily computed z-encoding of this string. -- -- Since FastStrings are globally memoized this is computed at -- most once for any given string. [fs_zenc] :: FastString -> FastZString -- | A PtrString is a pointer to some array of Latin-1 encoded -- chars. data PtrString PtrString :: !Ptr Word8 -> !Int -> PtrString -- | Does this TyCon represent a tuple? -- -- NB: when compiling Data.Tuple, the tycons won't reply -- True to isTupleTyCon, because they are built as -- AlgTyCons. However they get spat into the interface file as -- tuple tycons, so I don't think it matters. isTupleTyCon :: TyCon -> Bool -- | Is this the TyCon for an unboxed tuple? isUnboxedTupleTyCon :: TyCon -> Bool isFunTyCon :: TyCon -> Bool -- | TyCons represent type constructors. Type constructors are introduced -- by things such as: -- -- 1) Data declarations: data Foo = ... creates the Foo -- type constructor of kind * -- -- 2) Type synonyms: type Foo = ... creates the Foo -- type constructor -- -- 3) Newtypes: newtype Foo a = MkFoo ... creates the -- Foo type constructor of kind * -> * -- -- 4) Class declarations: class Foo where creates the -- Foo type constructor of kind * -- -- This data type also encodes a number of primitive, built in type -- constructors such as those for function and tuple types. data TyCon sGhcRtsWithLibdw :: Settings -> Bool sGhcDebugged :: Settings -> Bool sGhcThreaded :: Settings -> Bool sLibFFI :: Settings -> Bool sLeadingUnderscore :: Settings -> Bool sTablesNextToCode :: Settings -> Bool sGhcRTSWays :: Settings -> String sGhcWithSMP :: Settings -> Bool sGhcWithNativeCodeGen :: Settings -> Bool sGhcWithInterpreter :: Settings -> Bool sIntegerLibraryType :: Settings -> IntegerLibrary sIntegerLibrary :: Settings -> String sTargetPlatformString :: Settings -> String sExtraGccViaCFlags :: Settings -> [String] sOpt_i :: Settings -> [String] sOpt_lcc :: Settings -> [String] sOpt_lc :: Settings -> [String] sOpt_lo :: Settings -> [String] sOpt_windres :: Settings -> [String] sOpt_lm :: Settings -> [String] sOpt_l :: Settings -> [String] sOpt_a :: Settings -> [String] sOpt_cxx :: Settings -> [String] sOpt_c :: Settings -> [String] sOpt_F :: Settings -> [String] sOpt_P_fingerprint :: Settings -> Fingerprint sOpt_P :: Settings -> [String] sOpt_L :: Settings -> [String] sPgm_i :: Settings -> String sPgm_lcc :: Settings -> (String, [Option]) sPgm_lc :: Settings -> (String, [Option]) sPgm_lo :: Settings -> (String, [Option]) sPgm_ranlib :: Settings -> String sPgm_ar :: Settings -> String sPgm_libtool :: Settings -> String sPgm_windres :: Settings -> String sPgm_T :: Settings -> String sPgm_dll :: Settings -> (String, [Option]) sPgm_lm :: Settings -> (String, [Option]) sPgm_l :: Settings -> (String, [Option]) sPgm_a :: Settings -> (String, [Option]) sPgm_c :: Settings -> String sPgm_F :: Settings -> String sPgm_P :: Settings -> (String, [Option]) sPgm_L :: Settings -> String sGccSupportsNoPie :: Settings -> Bool sLdIsGnuLd :: Settings -> Bool sLdSupportsFilelist :: Settings -> Bool sLdSupportsBuildId :: Settings -> Bool sLdSupportsCompactUnwind :: Settings -> Bool sSystemPackageConfig :: Settings -> FilePath sTmpDir :: Settings -> String sTopDir :: Settings -> FilePath sToolDir :: Settings -> Maybe FilePath sGhciUsagePath :: Settings -> FilePath sGhcUsagePath :: Settings -> FilePath sProjectVersion :: Settings -> String sProgramName :: Settings -> String data Settings Settings :: {-# UNPACK #-} !GhcNameVersion -> {-# UNPACK #-} !FileSettings -> Platform -> {-# UNPACK #-} !ToolSettings -> {-# UNPACK #-} !PlatformMisc -> PlatformConstants -> [(String, String)] -> Settings [sGhcNameVersion] :: Settings -> {-# UNPACK #-} !GhcNameVersion [sFileSettings] :: Settings -> {-# UNPACK #-} !FileSettings [sTargetPlatform] :: Settings -> Platform [sToolSettings] :: Settings -> {-# UNPACK #-} !ToolSettings [sPlatformMisc] :: Settings -> {-# UNPACK #-} !PlatformMisc [sPlatformConstants] :: Settings -> PlatformConstants [sRawSettings] :: Settings -> [(String, String)] data PlatformConstants PlatformConstants :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Int -> Integer -> Integer -> Integer -> PlatformConstants [pc_CONTROL_GROUP_CONST_291] :: PlatformConstants -> Int [pc_STD_HDR_SIZE] :: PlatformConstants -> Int [pc_PROF_HDR_SIZE] :: PlatformConstants -> Int [pc_BLOCK_SIZE] :: PlatformConstants -> Int [pc_BLOCKS_PER_MBLOCK] :: PlatformConstants -> Int [pc_TICKY_BIN_COUNT] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR2] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR3] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR4] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR5] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR6] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR7] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR8] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR9] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rR10] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rF1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rF2] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rF3] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rF4] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rF5] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rF6] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rD1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rD2] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rD3] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rD4] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rD5] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rD6] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rXMM1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rXMM2] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rXMM3] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rXMM4] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rXMM5] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rXMM6] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rYMM1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rYMM2] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rYMM3] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rYMM4] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rYMM5] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rYMM6] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rZMM1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rZMM2] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rZMM3] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rZMM4] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rZMM5] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rZMM6] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rL1] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rSp] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rSpLim] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rHp] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rHpLim] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rCCCS] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rCurrentTSO] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rCurrentNursery] :: PlatformConstants -> Int [pc_OFFSET_StgRegTable_rHpAlloc] :: PlatformConstants -> Int [pc_OFFSET_stgEagerBlackholeInfo] :: PlatformConstants -> Int [pc_OFFSET_stgGCEnter1] :: PlatformConstants -> Int [pc_OFFSET_stgGCFun] :: PlatformConstants -> Int [pc_OFFSET_Capability_r] :: PlatformConstants -> Int [pc_OFFSET_bdescr_start] :: PlatformConstants -> Int [pc_OFFSET_bdescr_free] :: PlatformConstants -> Int [pc_OFFSET_bdescr_blocks] :: PlatformConstants -> Int [pc_OFFSET_bdescr_flags] :: PlatformConstants -> Int [pc_SIZEOF_CostCentreStack] :: PlatformConstants -> Int [pc_OFFSET_CostCentreStack_mem_alloc] :: PlatformConstants -> Int [pc_REP_CostCentreStack_mem_alloc] :: PlatformConstants -> Int [pc_OFFSET_CostCentreStack_scc_count] :: PlatformConstants -> Int [pc_REP_CostCentreStack_scc_count] :: PlatformConstants -> Int [pc_OFFSET_StgHeader_ccs] :: PlatformConstants -> Int [pc_OFFSET_StgHeader_ldvw] :: PlatformConstants -> Int [pc_SIZEOF_StgSMPThunkHeader] :: PlatformConstants -> Int [pc_OFFSET_StgEntCounter_allocs] :: PlatformConstants -> Int [pc_REP_StgEntCounter_allocs] :: PlatformConstants -> Int [pc_OFFSET_StgEntCounter_allocd] :: PlatformConstants -> Int [pc_REP_StgEntCounter_allocd] :: PlatformConstants -> Int [pc_OFFSET_StgEntCounter_registeredp] :: PlatformConstants -> Int [pc_OFFSET_StgEntCounter_link] :: PlatformConstants -> Int [pc_OFFSET_StgEntCounter_entry_count] :: PlatformConstants -> Int [pc_SIZEOF_StgUpdateFrame_NoHdr] :: PlatformConstants -> Int [pc_SIZEOF_StgMutArrPtrs_NoHdr] :: PlatformConstants -> Int [pc_OFFSET_StgMutArrPtrs_ptrs] :: PlatformConstants -> Int [pc_OFFSET_StgMutArrPtrs_size] :: PlatformConstants -> Int [pc_SIZEOF_StgSmallMutArrPtrs_NoHdr] :: PlatformConstants -> Int [pc_OFFSET_StgSmallMutArrPtrs_ptrs] :: PlatformConstants -> Int [pc_SIZEOF_StgArrBytes_NoHdr] :: PlatformConstants -> Int [pc_OFFSET_StgArrBytes_bytes] :: PlatformConstants -> Int [pc_OFFSET_StgTSO_alloc_limit] :: PlatformConstants -> Int [pc_OFFSET_StgTSO_cccs] :: PlatformConstants -> Int [pc_OFFSET_StgTSO_stackobj] :: PlatformConstants -> Int [pc_OFFSET_StgStack_sp] :: PlatformConstants -> Int [pc_OFFSET_StgStack_stack] :: PlatformConstants -> Int [pc_OFFSET_StgUpdateFrame_updatee] :: PlatformConstants -> Int [pc_OFFSET_StgFunInfoExtraFwd_arity] :: PlatformConstants -> Int [pc_REP_StgFunInfoExtraFwd_arity] :: PlatformConstants -> Int [pc_SIZEOF_StgFunInfoExtraRev] :: PlatformConstants -> Int [pc_OFFSET_StgFunInfoExtraRev_arity] :: PlatformConstants -> Int [pc_REP_StgFunInfoExtraRev_arity] :: PlatformConstants -> Int [pc_MAX_SPEC_SELECTEE_SIZE] :: PlatformConstants -> Int [pc_MAX_SPEC_AP_SIZE] :: PlatformConstants -> Int [pc_MIN_PAYLOAD_SIZE] :: PlatformConstants -> Int [pc_MIN_INTLIKE] :: PlatformConstants -> Int [pc_MAX_INTLIKE] :: PlatformConstants -> Int [pc_MIN_CHARLIKE] :: PlatformConstants -> Int [pc_MAX_CHARLIKE] :: PlatformConstants -> Int [pc_MUT_ARR_PTRS_CARD_BITS] :: PlatformConstants -> Int [pc_MAX_Vanilla_REG] :: PlatformConstants -> Int [pc_MAX_Float_REG] :: PlatformConstants -> Int [pc_MAX_Double_REG] :: PlatformConstants -> Int [pc_MAX_Long_REG] :: PlatformConstants -> Int [pc_MAX_XMM_REG] :: PlatformConstants -> Int [pc_MAX_Real_Vanilla_REG] :: PlatformConstants -> Int [pc_MAX_Real_Float_REG] :: PlatformConstants -> Int [pc_MAX_Real_Double_REG] :: PlatformConstants -> Int [pc_MAX_Real_XMM_REG] :: PlatformConstants -> Int [pc_MAX_Real_Long_REG] :: PlatformConstants -> Int [pc_RESERVED_C_STACK_BYTES] :: PlatformConstants -> Int [pc_RESERVED_STACK_WORDS] :: PlatformConstants -> Int [pc_AP_STACK_SPLIM] :: PlatformConstants -> Int [pc_WORD_SIZE] :: PlatformConstants -> Int [pc_DOUBLE_SIZE] :: PlatformConstants -> Int [pc_CINT_SIZE] :: PlatformConstants -> Int [pc_CLONG_SIZE] :: PlatformConstants -> Int [pc_CLONG_LONG_SIZE] :: PlatformConstants -> Int [pc_BITMAP_BITS_SHIFT] :: PlatformConstants -> Int [pc_TAG_BITS] :: PlatformConstants -> Int [pc_WORDS_BIGENDIAN] :: PlatformConstants -> Bool [pc_DYNAMIC_BY_DEFAULT] :: PlatformConstants -> Bool [pc_LDV_SHIFT] :: PlatformConstants -> Int [pc_ILDV_CREATE_MASK] :: PlatformConstants -> Integer [pc_ILDV_STATE_CREATE] :: PlatformConstants -> Integer [pc_ILDV_STATE_USE] :: PlatformConstants -> Integer -- | Temporarily install standard signal handlers for catching ^C, which -- just throw an exception in the current thread. withSignalHandlers :: (ExceptionMonad m, MonadIO m) => m a -> m a -- | Append a description of the given exception to this string. -- -- Note that this uses unsafeGlobalDynFlags, which may have some -- uninitialized fields if invoked before initGhcMonad has been -- called. If the error message to be printed includes a pretty-printer -- document which forces one of these fields this call may bottom. showGhcException :: GhcException -> ShowS -- | GHC's own exception type error messages all take the form: -- --
--   location: error
--   
--   
-- -- If the location is on the command line, or in GHC itself, then -- location="ghc". All of the error types below correspond to a -- location of "ghc", except for ProgramError (where the string is -- assumed to contain a location already, so we don't print one). data GhcException -- | Some other fatal signal (SIGHUP,SIGTERM) Signal :: Int -> GhcException -- | Prints the short usage msg after the error UsageError :: String -> GhcException -- | A problem with the command line arguments, but don't print usage. CmdLineError :: String -> GhcException -- | The impossible happened. Panic :: String -> GhcException PprPanic :: String -> SDoc -> GhcException -- | The user tickled something that's known not to work yet, but we're not -- counting it as a bug. Sorry :: String -> GhcException PprSorry :: String -> SDoc -> GhcException -- | An installation problem. InstallationError :: String -> GhcException -- | An error in the user's code, probably. ProgramError :: String -> GhcException PprProgramError :: String -> SDoc -> GhcException -- | Occurrence Name -- -- In this context that means: "classified (i.e. as a type name, value -- name, etc) but not qualified and not yet resolved" data OccName -- | A unique, unambiguous name for something, containing information about -- where that thing originated. data Name showOpt :: Option -> String -- | When invoking external tools as part of the compilation pipeline, we -- pass these a sequence of options on the command-line. Rather than just -- using a list of Strings, we use a type that allows us to distinguish -- between filepaths and 'other stuff'. The reason for this is that this -- type gives us a handle on transforming filenames, and filenames only, -- to whatever format they're expected to be on a particular platform. data Option FileOption :: String -> String -> Option Option :: String -> Option unsafeGlobalDynFlags :: DynFlags -- | An internal helper to check whether to use unicode syntax for output. -- -- Note: You should very likely be using unicodeSyntax instead of -- this function. useUnicodeSyntax :: DynFlags -> Bool useStarIsType :: DynFlags -> Bool shouldUseColor :: DynFlags -> Bool shouldUseHexWordLiterals :: DynFlags -> Bool hasPprDebug :: DynFlags -> Bool hasNoDebugOutput :: DynFlags -> Bool -- | Contains not only a collection of GeneralFlags but also a -- plethora of information relating to the compilation of a single file -- or GHC session data DynFlags DynFlags :: GhcMode -> GhcLink -> HscTarget -> {-# UNPACK #-} !GhcNameVersion -> {-# UNPACK #-} !FileSettings -> Platform -> {-# UNPACK #-} !ToolSettings -> {-# UNPACK #-} !PlatformMisc -> PlatformConstants -> [(String, String)] -> IntegerLibrary -> LlvmConfig -> Int -> Int -> Int -> Int -> Int -> Maybe String -> Maybe String -> [Int] -> Maybe Int -> Bool -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Int -> Int -> Int -> Maybe Int -> Maybe Int -> Int -> Word -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Bool -> Maybe Int -> Int -> [FilePath] -> Module -> Maybe String -> IntWithInf -> IntWithInf -> InstalledUnitId -> Maybe ComponentId -> Maybe [(ModuleName, Module)] -> [Way] -> String -> Maybe (String, Int) -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> String -> String -> String -> String -> IORef Bool -> String -> String -> Maybe String -> Maybe String -> Maybe String -> DynLibLoader -> Maybe FilePath -> Maybe FilePath -> [Option] -> IncludeSpecs -> [String] -> [String] -> [String] -> Maybe String -> RtsOptsEnabled -> Bool -> String -> [ModuleName] -> [(ModuleName, String)] -> [String] -> [LoadedPlugin] -> [StaticPlugin] -> Hooks -> FilePath -> Bool -> Bool -> [ModuleName] -> [String] -> [PackageDBFlag] -> [IgnorePackageFlag] -> [PackageFlag] -> [PackageFlag] -> [TrustFlag] -> Maybe FilePath -> Maybe [(FilePath, [PackageConfig])] -> PackageState -> IORef FilesToClean -> IORef (Map FilePath FilePath) -> IORef Int -> IORef (Set FilePath) -> EnumSet DumpFlag -> EnumSet GeneralFlag -> EnumSet WarningFlag -> EnumSet WarningFlag -> Maybe Language -> SafeHaskellMode -> Bool -> Bool -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> [OnOff Extension] -> EnumSet Extension -> Int -> Int -> Int -> Int -> Float -> Int -> Bool -> Int -> Int -> LogAction -> FlushOut -> FlushErr -> Maybe FilePath -> Maybe String -> [String] -> Int -> Int -> Bool -> OverridingBool -> Bool -> Scheme -> ProfAuto -> Maybe String -> IORef (ModuleEnv Int) -> Maybe SseVersion -> Maybe BmiVersion -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> IORef (Maybe LinkerInfo) -> IORef (Maybe CompilerInfo) -> Int -> Int -> Int -> Bool -> Maybe Int -> Int -> Int -> CfgWeights -> DynFlags [ghcMode] :: DynFlags -> GhcMode [ghcLink] :: DynFlags -> GhcLink [hscTarget] :: DynFlags -> HscTarget [ghcNameVersion] :: DynFlags -> {-# UNPACK #-} !GhcNameVersion [fileSettings] :: DynFlags -> {-# UNPACK #-} !FileSettings [targetPlatform] :: DynFlags -> Platform [toolSettings] :: DynFlags -> {-# UNPACK #-} !ToolSettings [platformMisc] :: DynFlags -> {-# UNPACK #-} !PlatformMisc [platformConstants] :: DynFlags -> PlatformConstants [rawSettings] :: DynFlags -> [(String, String)] -- | IntegerGMP or IntegerSimple. Set at configure time, but may be -- overriden by GHC-API users. See Note [The integer library] in -- PrelNames [integerLibrary] :: DynFlags -> IntegerLibrary -- | N.B. It's important that this field is lazy since we load the LLVM -- configuration lazily. See Note [LLVM Configuration] in SysTools. [llvmConfig] :: DynFlags -> LlvmConfig -- | Verbosity level: see Note [Verbosity levels] [verbosity] :: DynFlags -> Int -- | Optimisation level [optLevel] :: DynFlags -> Int -- | How much debug information to produce [debugLevel] :: DynFlags -> Int -- | Number of simplifier phases [simplPhases] :: DynFlags -> Int -- | Max simplifier iterations [maxSimplIterations] :: DynFlags -> Int [ruleCheck] :: DynFlags -> Maybe String -- | A prefix to report inlining decisions about [inlineCheck] :: DynFlags -> Maybe String -- | Additional demand analysis [strictnessBefore] :: DynFlags -> [Int] -- | The number of modules to compile in parallel in --make mode, where -- Nothing ==> compile as many in parallel as there are CPUs. [parMakeCount] :: DynFlags -> Maybe Int -- | Enable RTS timing statistics? [enableTimeStats] :: DynFlags -> Bool -- | The heap size to set. [ghcHeapSize] :: DynFlags -> Maybe Int -- | Maximum number of bindings from the type envt to show in type error -- messages [maxRelevantBinds] :: DynFlags -> Maybe Int -- | Maximum number of hole fits to show in typed hole error messages [maxValidHoleFits] :: DynFlags -> Maybe Int -- | Maximum number of refinement hole fits to show in typed hole error -- messages [maxRefHoleFits] :: DynFlags -> Maybe Int -- | Maximum level of refinement for refinement hole fits in typed hole -- error messages [refLevelHoleFits] :: DynFlags -> Maybe Int -- | Maximum number of unmatched patterns to show in non-exhaustiveness -- warnings [maxUncoveredPatterns] :: DynFlags -> Int -- | Soft limit on the number of models the pattern match checker checks a -- pattern against. A safe guard against exponential blow-up. [maxPmCheckModels] :: DynFlags -> Int -- | Multiplier for simplifier ticks [simplTickFactor] :: DynFlags -> Int -- | Threshold for SpecConstr [specConstrThreshold] :: DynFlags -> Maybe Int -- | Max number of specialisations for any one function [specConstrCount] :: DynFlags -> Maybe Int -- | Max number of specialisations for recursive types Not optional; -- otherwise ForceSpecConstr can diverge. [specConstrRecursive] :: DynFlags -> Int -- | Binary literals (e.g. strings) whose size is above this threshold will -- be dumped in a binary file by the assembler code generator (0 to -- disable) [binBlobThreshold] :: DynFlags -> Word -- | Threshold for LiberateCase [liberateCaseThreshold] :: DynFlags -> Maybe Int -- | Arg count for lambda floating See CoreMonad.FloatOutSwitches [floatLamArgs] :: DynFlags -> Maybe Int -- | Maximum number of arguments after lambda lifting a recursive function. [liftLamsRecArgs] :: DynFlags -> Maybe Int -- | Maximum number of arguments after lambda lifting a non-recursive -- function. [liftLamsNonRecArgs] :: DynFlags -> Maybe Int -- | Lambda lift even when this turns a known call into an unknown call. [liftLamsKnown] :: DynFlags -> Bool -- | Align Cmm functions at this boundary or use default. [cmmProcAlignment] :: DynFlags -> Maybe Int -- | Simplification history size [historySize] :: DynFlags -> Int [importPaths] :: DynFlags -> [FilePath] [mainModIs] :: DynFlags -> Module [mainFunIs] :: DynFlags -> Maybe String -- | Typechecker maximum stack depth [reductionDepth] :: DynFlags -> IntWithInf -- | Number of iterations in the constraints solver Typically only 1 is -- needed [solverIterations] :: DynFlags -> IntWithInf [thisInstalledUnitId] :: DynFlags -> InstalledUnitId [thisComponentId_] :: DynFlags -> Maybe ComponentId [thisUnitIdInsts_] :: DynFlags -> Maybe [(ModuleName, Module)] -- | Way flags from the command line [ways] :: DynFlags -> [Way] -- | The global "way" (e.g. "p" for prof) [buildTag] :: DynFlags -> String [splitInfo] :: DynFlags -> Maybe (String, Int) [objectDir] :: DynFlags -> Maybe String [dylibInstallName] :: DynFlags -> Maybe String [hiDir] :: DynFlags -> Maybe String [hieDir] :: DynFlags -> Maybe String [stubDir] :: DynFlags -> Maybe String [dumpDir] :: DynFlags -> Maybe String [objectSuf] :: DynFlags -> String [hcSuf] :: DynFlags -> String [hiSuf] :: DynFlags -> String [hieSuf] :: DynFlags -> String [canGenerateDynamicToo] :: DynFlags -> IORef Bool [dynObjectSuf] :: DynFlags -> String [dynHiSuf] :: DynFlags -> String [outputFile] :: DynFlags -> Maybe String [dynOutputFile] :: DynFlags -> Maybe String [outputHi] :: DynFlags -> Maybe String [dynLibLoader] :: DynFlags -> DynLibLoader -- | This is set by runPipeline based on where its output is going. [dumpPrefix] :: DynFlags -> Maybe FilePath -- | Override the dumpPrefix set by runPipeline. Set by -- -ddump-file-prefix [dumpPrefixForce] :: DynFlags -> Maybe FilePath [ldInputs] :: DynFlags -> [Option] [includePaths] :: DynFlags -> IncludeSpecs [libraryPaths] :: DynFlags -> [String] [frameworkPaths] :: DynFlags -> [String] [cmdlineFrameworks] :: DynFlags -> [String] [rtsOpts] :: DynFlags -> Maybe String [rtsOptsEnabled] :: DynFlags -> RtsOptsEnabled [rtsOptsSuggestions] :: DynFlags -> Bool -- | Path to store the .mix files [hpcDir] :: DynFlags -> String [pluginModNames] :: DynFlags -> [ModuleName] [pluginModNameOpts] :: DynFlags -> [(ModuleName, String)] -- | the -ffrontend-opt flags given on the command line, in -- *reverse* order that they're specified on the command line. [frontendPluginOpts] :: DynFlags -> [String] -- | plugins dynamically loaded after processing arguments. What will be -- loaded here is directed by pluginModNames. Arguments are loaded from -- pluginModNameOpts. The purpose of this field is to cache the plugins -- so they don't have to be loaded each time they are needed. See -- initializePlugins. [cachedPlugins] :: DynFlags -> [LoadedPlugin] -- | staic plugins which do not need dynamic loading. These plugins are -- intended to be added by GHC API users directly to this list. -- -- To add dynamically loaded plugins through the GHC API see -- addPluginModuleName instead. [staticPlugins] :: DynFlags -> [StaticPlugin] [hooks] :: DynFlags -> Hooks [depMakefile] :: DynFlags -> FilePath [depIncludePkgDeps] :: DynFlags -> Bool [depIncludeCppDeps] :: DynFlags -> Bool [depExcludeMods] :: DynFlags -> [ModuleName] [depSuffixes] :: DynFlags -> [String] -- | The -package-db flags given on the command line, In *reverse* -- order that they're specified on the command line. This is intended to -- be applied with the list of "initial" package databases derived from -- GHC_PACKAGE_PATH; see getPackageConfRefs. [packageDBFlags] :: DynFlags -> [PackageDBFlag] -- | The -ignore-package flags from the command line. In *reverse* -- order that they're specified on the command line. [ignorePackageFlags] :: DynFlags -> [IgnorePackageFlag] -- | The -package and -hide-package flags from the -- command-line. In *reverse* order that they're specified on the command -- line. [packageFlags] :: DynFlags -> [PackageFlag] -- | The -plugin-package-id flags from command line. In *reverse* -- order that they're specified on the command line. [pluginPackageFlags] :: DynFlags -> [PackageFlag] -- | The -trust and -distrust flags. In *reverse* order -- that they're specified on the command line. [trustFlags] :: DynFlags -> [TrustFlag] -- | Filepath to the package environment file (if overriding default) [packageEnv] :: DynFlags -> Maybe FilePath [pkgDatabase] :: DynFlags -> Maybe [(FilePath, [PackageConfig])] [pkgState] :: DynFlags -> PackageState [filesToClean] :: DynFlags -> IORef FilesToClean [dirsToClean] :: DynFlags -> IORef (Map FilePath FilePath) [nextTempSuffix] :: DynFlags -> IORef Int [generatedDumps] :: DynFlags -> IORef (Set FilePath) [dumpFlags] :: DynFlags -> EnumSet DumpFlag [generalFlags] :: DynFlags -> EnumSet GeneralFlag [warningFlags] :: DynFlags -> EnumSet WarningFlag [fatalWarningFlags] :: DynFlags -> EnumSet WarningFlag [language] :: DynFlags -> Maybe Language -- | Safe Haskell mode [safeHaskell] :: DynFlags -> SafeHaskellMode [safeInfer] :: DynFlags -> Bool [safeInferred] :: DynFlags -> Bool [thOnLoc] :: DynFlags -> SrcSpan [newDerivOnLoc] :: DynFlags -> SrcSpan [overlapInstLoc] :: DynFlags -> SrcSpan [incoherentOnLoc] :: DynFlags -> SrcSpan [pkgTrustOnLoc] :: DynFlags -> SrcSpan [warnSafeOnLoc] :: DynFlags -> SrcSpan [warnUnsafeOnLoc] :: DynFlags -> SrcSpan [trustworthyOnLoc] :: DynFlags -> SrcSpan [extensions] :: DynFlags -> [OnOff Extension] [extensionFlags] :: DynFlags -> EnumSet Extension [ufCreationThreshold] :: DynFlags -> Int [ufUseThreshold] :: DynFlags -> Int [ufFunAppDiscount] :: DynFlags -> Int [ufDictDiscount] :: DynFlags -> Int [ufKeenessFactor] :: DynFlags -> Float [ufDearOp] :: DynFlags -> Int [ufVeryAggressive] :: DynFlags -> Bool [maxWorkerArgs] :: DynFlags -> Int [ghciHistSize] :: DynFlags -> Int -- | MsgDoc output action: use ErrUtils instead of this if you can [log_action] :: DynFlags -> LogAction [flushOut] :: DynFlags -> FlushOut [flushErr] :: DynFlags -> FlushErr [ghcVersionFile] :: DynFlags -> Maybe FilePath [haddockOptions] :: DynFlags -> Maybe String -- | GHCi scripts specified by -ghci-script, in reverse order [ghciScripts] :: DynFlags -> [String] [pprUserLength] :: DynFlags -> Int [pprCols] :: DynFlags -> Int [useUnicode] :: DynFlags -> Bool [useColor] :: DynFlags -> OverridingBool [canUseColor] :: DynFlags -> Bool [colScheme] :: DynFlags -> Scheme -- | what kind of {--} to add automatically [profAuto] :: DynFlags -> ProfAuto [interactivePrint] :: DynFlags -> Maybe String [nextWrapperNum] :: DynFlags -> IORef (ModuleEnv Int) -- | Machine dependent flags (-mblah stuff) [sseVersion] :: DynFlags -> Maybe SseVersion [bmiVersion] :: DynFlags -> Maybe BmiVersion [avx] :: DynFlags -> Bool [avx2] :: DynFlags -> Bool [avx512cd] :: DynFlags -> Bool [avx512er] :: DynFlags -> Bool [avx512f] :: DynFlags -> Bool [avx512pf] :: DynFlags -> Bool -- | Run-time linker information (what options we need, etc.) [rtldInfo] :: DynFlags -> IORef (Maybe LinkerInfo) -- | Run-time compiler information [rtccInfo] :: DynFlags -> IORef (Maybe CompilerInfo) -- | Max size, in bytes, of inline array allocations. [maxInlineAllocSize] :: DynFlags -> Int -- | Only inline memcpy if it generates no more than this many pseudo -- (roughly: Cmm) instructions. [maxInlineMemcpyInsns] :: DynFlags -> Int -- | Only inline memset if it generates no more than this many pseudo -- (roughly: Cmm) instructions. [maxInlineMemsetInsns] :: DynFlags -> Int -- | Reverse the order of error messages in GHC/GHCi [reverseErrors] :: DynFlags -> Bool -- | Limit the maximum number of errors to show [maxErrors] :: DynFlags -> Maybe Int -- | Unique supply configuration for testing build determinism [initialUnique] :: DynFlags -> Int [uniqueIncrement] :: DynFlags -> Int -- | Temporary: CFG Edge weights for fast iterations [cfgWeightInfo] :: DynFlags -> CfgWeights data DumpFlag Opt_D_dump_cmm :: DumpFlag Opt_D_dump_cmm_from_stg :: DumpFlag Opt_D_dump_cmm_raw :: DumpFlag Opt_D_dump_cmm_verbose_by_proc :: DumpFlag Opt_D_dump_cmm_verbose :: DumpFlag Opt_D_dump_cmm_cfg :: DumpFlag Opt_D_dump_cmm_cbe :: DumpFlag Opt_D_dump_cmm_switch :: DumpFlag Opt_D_dump_cmm_proc :: DumpFlag Opt_D_dump_cmm_sp :: DumpFlag Opt_D_dump_cmm_sink :: DumpFlag Opt_D_dump_cmm_caf :: DumpFlag Opt_D_dump_cmm_procmap :: DumpFlag Opt_D_dump_cmm_split :: DumpFlag Opt_D_dump_cmm_info :: DumpFlag Opt_D_dump_cmm_cps :: DumpFlag -- | Dump the cfg used for block layout. Opt_D_dump_cfg_weights :: DumpFlag Opt_D_dump_asm :: DumpFlag Opt_D_dump_asm_native :: DumpFlag Opt_D_dump_asm_liveness :: DumpFlag Opt_D_dump_asm_regalloc :: DumpFlag Opt_D_dump_asm_regalloc_stages :: DumpFlag Opt_D_dump_asm_conflicts :: DumpFlag Opt_D_dump_asm_stats :: DumpFlag Opt_D_dump_asm_expanded :: DumpFlag Opt_D_dump_llvm :: DumpFlag Opt_D_dump_core_stats :: DumpFlag Opt_D_dump_deriv :: DumpFlag Opt_D_dump_ds :: DumpFlag Opt_D_dump_ds_preopt :: DumpFlag Opt_D_dump_foreign :: DumpFlag Opt_D_dump_inlinings :: DumpFlag Opt_D_dump_rule_firings :: DumpFlag Opt_D_dump_rule_rewrites :: DumpFlag Opt_D_dump_simpl_trace :: DumpFlag Opt_D_dump_occur_anal :: DumpFlag Opt_D_dump_parsed :: DumpFlag Opt_D_dump_parsed_ast :: DumpFlag Opt_D_dump_rn :: DumpFlag Opt_D_dump_rn_ast :: DumpFlag Opt_D_dump_simpl :: DumpFlag Opt_D_dump_simpl_iterations :: DumpFlag Opt_D_dump_spec :: DumpFlag Opt_D_dump_prep :: DumpFlag Opt_D_dump_stg :: DumpFlag Opt_D_dump_stg_unarised :: DumpFlag Opt_D_dump_stg_final :: DumpFlag Opt_D_dump_call_arity :: DumpFlag Opt_D_dump_exitify :: DumpFlag Opt_D_dump_stranal :: DumpFlag Opt_D_dump_str_signatures :: DumpFlag Opt_D_dump_tc :: DumpFlag Opt_D_dump_tc_ast :: DumpFlag Opt_D_dump_types :: DumpFlag Opt_D_dump_rules :: DumpFlag Opt_D_dump_cse :: DumpFlag Opt_D_dump_worker_wrapper :: DumpFlag Opt_D_dump_rn_trace :: DumpFlag Opt_D_dump_rn_stats :: DumpFlag Opt_D_dump_opt_cmm :: DumpFlag Opt_D_dump_simpl_stats :: DumpFlag Opt_D_dump_cs_trace :: DumpFlag Opt_D_dump_tc_trace :: DumpFlag Opt_D_dump_ec_trace :: DumpFlag Opt_D_dump_if_trace :: DumpFlag Opt_D_dump_vt_trace :: DumpFlag Opt_D_dump_splices :: DumpFlag Opt_D_th_dec_file :: DumpFlag Opt_D_dump_BCOs :: DumpFlag Opt_D_dump_ticked :: DumpFlag Opt_D_dump_rtti :: DumpFlag Opt_D_source_stats :: DumpFlag Opt_D_verbose_stg2stg :: DumpFlag Opt_D_dump_hi :: DumpFlag Opt_D_dump_hi_diffs :: DumpFlag Opt_D_dump_mod_cycles :: DumpFlag Opt_D_dump_mod_map :: DumpFlag Opt_D_dump_timings :: DumpFlag Opt_D_dump_view_pattern_commoning :: DumpFlag Opt_D_verbose_core2core :: DumpFlag Opt_D_dump_debug :: DumpFlag Opt_D_dump_json :: DumpFlag Opt_D_ppr_debug :: DumpFlag Opt_D_no_debug_output :: DumpFlag -- | Enumerates the simple on-or-off dynamic flags data GeneralFlag -- | Append dump output to files instead of stdout. Opt_DumpToFile :: GeneralFlag Opt_D_faststring_stats :: GeneralFlag Opt_D_dump_minimal_imports :: GeneralFlag Opt_DoCoreLinting :: GeneralFlag Opt_DoStgLinting :: GeneralFlag Opt_DoCmmLinting :: GeneralFlag Opt_DoAsmLinting :: GeneralFlag Opt_DoAnnotationLinting :: GeneralFlag Opt_NoLlvmMangler :: GeneralFlag Opt_FastLlvm :: GeneralFlag Opt_NoTypeableBinds :: GeneralFlag Opt_WarnIsError :: GeneralFlag Opt_ShowWarnGroups :: GeneralFlag Opt_HideSourcePaths :: GeneralFlag Opt_PrintExplicitForalls :: GeneralFlag Opt_PrintExplicitKinds :: GeneralFlag Opt_PrintExplicitCoercions :: GeneralFlag Opt_PrintExplicitRuntimeReps :: GeneralFlag Opt_PrintEqualityRelations :: GeneralFlag Opt_PrintAxiomIncomps :: GeneralFlag Opt_PrintUnicodeSyntax :: GeneralFlag Opt_PrintExpandedSynonyms :: GeneralFlag Opt_PrintPotentialInstances :: GeneralFlag Opt_PrintTypecheckerElaboration :: GeneralFlag Opt_CallArity :: GeneralFlag Opt_Exitification :: GeneralFlag Opt_Strictness :: GeneralFlag Opt_LateDmdAnal :: GeneralFlag Opt_KillAbsence :: GeneralFlag Opt_KillOneShot :: GeneralFlag Opt_FullLaziness :: GeneralFlag Opt_FloatIn :: GeneralFlag Opt_LateSpecialise :: GeneralFlag Opt_Specialise :: GeneralFlag Opt_SpecialiseAggressively :: GeneralFlag Opt_CrossModuleSpecialise :: GeneralFlag Opt_StaticArgumentTransformation :: GeneralFlag Opt_CSE :: GeneralFlag Opt_StgCSE :: GeneralFlag Opt_StgLiftLams :: GeneralFlag Opt_LiberateCase :: GeneralFlag Opt_SpecConstr :: GeneralFlag Opt_SpecConstrKeen :: GeneralFlag Opt_DoLambdaEtaExpansion :: GeneralFlag Opt_IgnoreAsserts :: GeneralFlag Opt_DoEtaReduction :: GeneralFlag Opt_CaseMerge :: GeneralFlag Opt_CaseFolding :: GeneralFlag Opt_UnboxStrictFields :: GeneralFlag Opt_UnboxSmallStrictFields :: GeneralFlag Opt_DictsCheap :: GeneralFlag Opt_EnableRewriteRules :: GeneralFlag Opt_EnableThSpliceWarnings :: GeneralFlag Opt_RegsGraph :: GeneralFlag Opt_RegsIterative :: GeneralFlag Opt_PedanticBottoms :: GeneralFlag Opt_LlvmTBAA :: GeneralFlag Opt_LlvmFillUndefWithGarbage :: GeneralFlag Opt_IrrefutableTuples :: GeneralFlag Opt_CmmSink :: GeneralFlag Opt_CmmElimCommonBlocks :: GeneralFlag Opt_AsmShortcutting :: GeneralFlag Opt_OmitYields :: GeneralFlag Opt_FunToThunk :: GeneralFlag Opt_DictsStrict :: GeneralFlag Opt_DmdTxDictSel :: GeneralFlag Opt_Loopification :: GeneralFlag -- | Use the cfg based block layout algorithm. Opt_CfgBlocklayout :: GeneralFlag -- | Layout based on last instruction per block. Opt_WeightlessBlocklayout :: GeneralFlag Opt_CprAnal :: GeneralFlag Opt_WorkerWrapper :: GeneralFlag Opt_SolveConstantDicts :: GeneralFlag Opt_AlignmentSanitisation :: GeneralFlag Opt_CatchBottoms :: GeneralFlag Opt_NumConstantFolding :: GeneralFlag Opt_SimplPreInlining :: GeneralFlag Opt_IgnoreInterfacePragmas :: GeneralFlag Opt_OmitInterfacePragmas :: GeneralFlag Opt_ExposeAllUnfoldings :: GeneralFlag Opt_WriteInterface :: GeneralFlag Opt_WriteHie :: GeneralFlag Opt_AutoSccsOnIndividualCafs :: GeneralFlag Opt_ProfCountEntries :: GeneralFlag Opt_Pp :: GeneralFlag Opt_ForceRecomp :: GeneralFlag Opt_IgnoreOptimChanges :: GeneralFlag Opt_IgnoreHpcChanges :: GeneralFlag Opt_ExcessPrecision :: GeneralFlag Opt_EagerBlackHoling :: GeneralFlag Opt_NoHsMain :: GeneralFlag Opt_SplitSections :: GeneralFlag Opt_StgStats :: GeneralFlag Opt_HideAllPackages :: GeneralFlag Opt_HideAllPluginPackages :: GeneralFlag Opt_PrintBindResult :: GeneralFlag Opt_Haddock :: GeneralFlag Opt_HaddockOptions :: GeneralFlag Opt_BreakOnException :: GeneralFlag Opt_BreakOnError :: GeneralFlag Opt_PrintEvldWithShow :: GeneralFlag Opt_PrintBindContents :: GeneralFlag Opt_GenManifest :: GeneralFlag Opt_EmbedManifest :: GeneralFlag Opt_SharedImplib :: GeneralFlag Opt_BuildingCabalPackage :: GeneralFlag Opt_IgnoreDotGhci :: GeneralFlag Opt_GhciSandbox :: GeneralFlag Opt_GhciHistory :: GeneralFlag Opt_GhciLeakCheck :: GeneralFlag Opt_ValidateHie :: GeneralFlag Opt_LocalGhciHistory :: GeneralFlag Opt_NoIt :: GeneralFlag Opt_HelpfulErrors :: GeneralFlag Opt_DeferTypeErrors :: GeneralFlag Opt_DeferTypedHoles :: GeneralFlag Opt_DeferOutOfScopeVariables :: GeneralFlag -- |
--   -fPIC
--   
Opt_PIC :: GeneralFlag -- |
--   -fPIE
--   
Opt_PIE :: GeneralFlag -- |
--   -pie
--   
Opt_PICExecutable :: GeneralFlag Opt_ExternalDynamicRefs :: GeneralFlag Opt_SccProfilingOn :: GeneralFlag Opt_Ticky :: GeneralFlag Opt_Ticky_Allocd :: GeneralFlag Opt_Ticky_LNE :: GeneralFlag Opt_Ticky_Dyn_Thunk :: GeneralFlag Opt_RPath :: GeneralFlag Opt_RelativeDynlibPaths :: GeneralFlag Opt_Hpc :: GeneralFlag Opt_FlatCache :: GeneralFlag Opt_ExternalInterpreter :: GeneralFlag Opt_OptimalApplicativeDo :: GeneralFlag Opt_VersionMacros :: GeneralFlag Opt_WholeArchiveHsLibs :: GeneralFlag Opt_SingleLibFolder :: GeneralFlag Opt_KeepCAFs :: GeneralFlag Opt_KeepGoing :: GeneralFlag Opt_ByteCode :: GeneralFlag Opt_ErrorSpans :: GeneralFlag Opt_DeferDiagnostics :: GeneralFlag Opt_DiagnosticsShowCaret :: GeneralFlag Opt_PprCaseAsLet :: GeneralFlag Opt_PprShowTicks :: GeneralFlag Opt_ShowHoleConstraints :: GeneralFlag Opt_ShowValidHoleFits :: GeneralFlag Opt_SortValidHoleFits :: GeneralFlag Opt_SortBySizeHoleFits :: GeneralFlag Opt_SortBySubsumHoleFits :: GeneralFlag Opt_AbstractRefHoleFits :: GeneralFlag Opt_UnclutterValidHoleFits :: GeneralFlag Opt_ShowTypeAppOfHoleFits :: GeneralFlag Opt_ShowTypeAppVarsOfHoleFits :: GeneralFlag Opt_ShowDocsOfHoleFits :: GeneralFlag Opt_ShowTypeOfHoleFits :: GeneralFlag Opt_ShowProvOfHoleFits :: GeneralFlag Opt_ShowMatchesOfHoleFits :: GeneralFlag Opt_ShowLoadedModules :: GeneralFlag Opt_HexWordLiterals :: GeneralFlag Opt_SuppressCoercions :: GeneralFlag Opt_SuppressVarKinds :: GeneralFlag Opt_SuppressModulePrefixes :: GeneralFlag Opt_SuppressTypeApplications :: GeneralFlag Opt_SuppressIdInfo :: GeneralFlag Opt_SuppressUnfoldings :: GeneralFlag Opt_SuppressTypeSignatures :: GeneralFlag Opt_SuppressUniques :: GeneralFlag Opt_SuppressStgExts :: GeneralFlag Opt_SuppressTicks :: GeneralFlag -- | Suppress timestamps in dumps Opt_SuppressTimestamps :: GeneralFlag Opt_AutoLinkPackages :: GeneralFlag Opt_ImplicitImportQualified :: GeneralFlag Opt_KeepHscppFiles :: GeneralFlag Opt_KeepHiDiffs :: GeneralFlag Opt_KeepHcFiles :: GeneralFlag Opt_KeepSFiles :: GeneralFlag Opt_KeepTmpFiles :: GeneralFlag Opt_KeepRawTokenStream :: GeneralFlag Opt_KeepLlvmFiles :: GeneralFlag Opt_KeepHiFiles :: GeneralFlag Opt_KeepOFiles :: GeneralFlag Opt_BuildDynamicToo :: GeneralFlag Opt_DistrustAllPackages :: GeneralFlag Opt_PackageTrust :: GeneralFlag Opt_PluginTrustworthy :: GeneralFlag Opt_G_NoStateHack :: GeneralFlag Opt_G_NoOptCoercion :: GeneralFlag -- | Generalised version of finally, allowing an arbitrary exception -- handling monad instead of just IO. gfinally :: ExceptionMonad m => m a -> m b -> m a -- | Generalised version of catch, allowing an arbitrary exception -- handling monad instead of just IO. gcatch :: (ExceptionMonad m, Exception e) => m a -> (e -> m a) -> m a -- | Generalised version of bracket, allowing an arbitrary exception -- handling monad instead of just IO. gbracket :: ExceptionMonad m => m a -> (a -> m b) -> (a -> m c) -> m c -- | Paths to various files and directories used by GHC, including those -- that provide more settings. data FileSettings FileSettings :: FilePath -> FilePath -> Maybe FilePath -> FilePath -> String -> FilePath -> FileSettings [fileSettings_ghcUsagePath] :: FileSettings -> FilePath [fileSettings_ghciUsagePath] :: FileSettings -> FilePath [fileSettings_toolDir] :: FileSettings -> Maybe FilePath [fileSettings_topDir] :: FileSettings -> FilePath [fileSettings_tmpDir] :: FileSettings -> String [fileSettings_systemPackageConfig] :: FileSettings -> FilePath -- | Settings for what GHC this is. data GhcNameVersion GhcNameVersion :: String -> String -> GhcNameVersion [ghcNameVersion_programName] :: GhcNameVersion -> String [ghcNameVersion_projectVersion] :: GhcNameVersion -> String type ForeignHValue = ForeignRef HValue data HValue data IntegerLibrary IntegerGMP :: IntegerLibrary IntegerSimple :: IntegerLibrary -- | Platform-specific settings formerly hard-coded in Config.hs. -- -- These should probably be all be triaged whether they can be computed -- from other settings or belong in another another place (like -- Platform above). data PlatformMisc PlatformMisc :: String -> String -> IntegerLibrary -> Bool -> Bool -> Bool -> String -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> String -> PlatformMisc [platformMisc_targetPlatformString] :: PlatformMisc -> String [platformMisc_integerLibrary] :: PlatformMisc -> String [platformMisc_integerLibraryType] :: PlatformMisc -> IntegerLibrary [platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool [platformMisc_ghcWithNativeCodeGen] :: PlatformMisc -> Bool [platformMisc_ghcWithSMP] :: PlatformMisc -> Bool [platformMisc_ghcRTSWays] :: PlatformMisc -> String -- | Determines whether we will be compiling info tables that reside just -- before the entry code, or with an indirection to the entry code. See -- TABLES_NEXT_TO_CODE in includesrtsstorage/InfoTables.h. [platformMisc_tablesNextToCode] :: PlatformMisc -> Bool [platformMisc_leadingUnderscore] :: PlatformMisc -> Bool [platformMisc_libFFI] :: PlatformMisc -> Bool [platformMisc_ghcThreaded] :: PlatformMisc -> Bool [platformMisc_ghcDebugged] :: PlatformMisc -> Bool [platformMisc_ghcRtsWithLibdw] :: PlatformMisc -> Bool [platformMisc_llvmTarget] :: PlatformMisc -> String -- | Foreign formats supported by GHC via TH data ForeignSrcLang -- | C LangC :: ForeignSrcLang -- | C++ LangCxx :: ForeignSrcLang -- | Objective C LangObjc :: ForeignSrcLang -- | Objective C++ LangObjcxx :: ForeignSrcLang -- | Assembly language (.s) LangAsm :: ForeignSrcLang -- | Object (.o) RawObject :: ForeignSrcLang coreModule :: DesugaredMod m => m -> ModGuts -- | -- -- The semantics of tyConArity changed between GHC 8.6.5 and GHC -- 8.10, mostly due to the Visible Dependent Quantification (VDQ). As a -- result, given the following: -- -- data family EntityField record :: * -> * -- -- Calling tyConArity on this would yield 2 for 8.6.5 but -- 1 an 8.10, so we try to backport the old behaviour in 8.10 by -- "looking" at the Kind of the input TyCon and trying to -- recursively split the type apart with either splitFunTy_maybe -- or splitForAllTy_maybe. -- -- -- -- For GHC < 8.10.1 isPredTy is effectively the same as the -- new isEvVarType, which covers the cases for coercion types and -- "normal" type coercions. The 8.6.5 version of isPredTy had a -- special case to handle a TyConApp in the case of type equality -- (i.e. ~ ) which was removed in the implementation for 8.10.1, which -- essentially calls tcIsConstraintKind straight away. tyConRealArity :: TyCon -> Int dataConExTyVars :: DataCon -> [TyVar] -- | This module introduces a "lighter" GhcMonad typeclass which -- doesn't require an instance of ExceptionMonad, and can -- therefore be used for both CoreM and Ghc. module Language.Haskell.Liquid.GHC.GhcMonadLike class HasHscEnv m -- | A typeclass which is very similar to the existing -- GhcMonad, but it doesn't impose a ExceptionMonad -- constraint. class (Functor m, MonadIO m, HasHscEnv m, HasDynFlags m) => GhcMonadLike m -- | Our own simplified version of ModuleInfo to overcome the fact -- we cannot construct the "original" one as the constructor is not -- exported, and getHomeModuleInfo and -- getPackageModuleInfo are not exported either, so we had to -- backport them as well. data ModuleInfo -- | Our own simplified version of TypecheckedModule. data TypecheckedModule TypecheckedModule :: ParsedModule -> Maybe RenamedSource -> ModSummary -> TcGblEnv -> TypecheckedModule [tm_parsed_module] :: TypecheckedModule -> ParsedModule [tm_renamed_source] :: TypecheckedModule -> Maybe RenamedSource [tm_mod_summary] :: TypecheckedModule -> ModSummary [tm_gbl_env] :: TypecheckedModule -> TcGblEnv askHscEnv :: HasHscEnv m => m HscEnv getModuleGraph :: GhcMonadLike m => m ModuleGraph getModSummary :: GhcMonadLike m => ModuleName -> m ModSummary lookupModSummary :: GhcMonadLike m => ModuleName -> m (Maybe ModSummary) lookupGlobalName :: GhcMonadLike m => Name -> m (Maybe TyThing) lookupName :: GhcMonadLike m => Name -> m (Maybe TyThing) modInfoLookupName :: GhcMonadLike m => ModuleInfo -> Name -> m (Maybe TyThing) moduleInfoTc :: GhcMonadLike m => ModSummary -> TcGblEnv -> m ModuleInfo parseModule :: GhcMonadLike m => ModSummary -> m ParsedModule typecheckModule :: GhcMonadLike m => ParsedModule -> m TypecheckedModule -- | Desugar a typechecked module. desugarModule :: (GhcMonadLike m, IsTypecheckedModule t) => ModSummary -> t -> m ModGuts -- | Takes a ModuleName and possibly a UnitId, and consults -- the filesystem and package database to find the corresponding -- Module, using the algorithm that is used for an import -- declaration. findModule :: GhcMonadLike m => ModuleName -> Maybe FastString -> m Module lookupModule :: GhcMonadLike m => ModuleName -> Maybe FastString -> m Module instance Language.Haskell.Liquid.GHC.GhcMonadLike.IsTypecheckedModule Language.Haskell.Liquid.GHC.GhcMonadLike.TypecheckedModule instance Language.Haskell.Liquid.GHC.GhcMonadLike.IsTypecheckedModule GHC.TypecheckedModule instance Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike CoreMonad.CoreM instance Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike GhcMonad.Ghc instance Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike (TcRnTypes.IfM lcl) instance Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike TcRnTypes.TcM instance Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike HscTypes.Hsc instance (Exception.ExceptionMonad m, Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike m) => Language.Haskell.Liquid.GHC.GhcMonadLike.GhcMonadLike (GhcMonad.GhcT m) instance Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv CoreMonad.CoreM instance Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv GhcMonad.Ghc instance Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv (TcRnTypes.IfM lcl) instance Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv TcRnTypes.TcM instance Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv HscTypes.Hsc instance (Exception.ExceptionMonad m, Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv m) => Language.Haskell.Liquid.GHC.GhcMonadLike.HasHscEnv (GhcMonad.GhcT m) module Language.Haskell.Liquid.GHC.Plugin.Tutorial module Language.Haskell.Liquid.GHC.Types -- | A StableName is virtually isomorphic to a GHC's Name but -- crucially we don't use the Eq instance defined on a Name -- because it's Unique-based. In particular, GHC doesn't guarantee -- that if we load an interface multiple times we would get the same -- Unique for the same Name, and this is a problem when we -- rely on Names to be the same when we call -- isExportedVar, which used to use a NameSet derived -- from the '[AvailInfo]'. As the name implies, a NameSet uses a -- Names Unique for duplicate detection and indexing, and -- this would lead to Vars being resolved to a Name which -- is basically the same, but it has a different Unique, -- and that would cause the lookup inside the NameSet to fail. newtype StableName MkStableName :: Name -> StableName [unStableName] :: StableName -> Name -- | Creates a new StableName out of a Name. mkStableName :: Name -> StableName -- | Converts a list of AvailInfo into a "StableNameSet", similarly -- to what availsToNameSet would do. availsToStableNameSet :: [AvailInfo] -> HashSet StableName -- | Datatype For Holding GHC ModGuts -- ------------------------------------------ data MGIModGuts MI :: !CoreProgram -> !Module -> !Dependencies -> ![ModuleName] -> !GlobalRdrEnv -> ![TyCon] -> ![FamInst] -> !HashSet StableName -> !Maybe [ClsInst] -> MGIModGuts [mgi_binds] :: MGIModGuts -> !CoreProgram [mgi_module] :: MGIModGuts -> !Module [mgi_deps] :: MGIModGuts -> !Dependencies [mgi_dir_imps] :: MGIModGuts -> ![ModuleName] [mgi_rdr_env] :: MGIModGuts -> !GlobalRdrEnv [mgi_tcs] :: MGIModGuts -> ![TyCon] [mgi_fam_insts] :: MGIModGuts -> ![FamInst] [mgi_exports] :: MGIModGuts -> !HashSet StableName [mgi_cls_inst] :: MGIModGuts -> !Maybe [ClsInst] miModGuts :: Maybe [ClsInst] -> ModGuts -> MGIModGuts nameSetToStableNameSet :: NameSet -> HashSet StableName mg_dir_imps :: ModGuts -> [ModuleName] mgi_namestring :: MGIModGuts -> String instance GHC.Generics.Generic Language.Haskell.Liquid.GHC.Types.StableName instance GHC.Show.Show Language.Haskell.Liquid.GHC.Types.StableName instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.GHC.Types.StableName instance GHC.Classes.Eq Language.Haskell.Liquid.GHC.Types.StableName -- | Geriving instances, generically. This module shares some of the -- underlying ideas and implementations of the generic-data -- package, allowing us to derive a bunch of instances using the -- underlying Generic implementation, but in a more declarative -- way. -- -- In particular we introduc the Generically newtype wrapper to be -- used with '-XDerivingVia' to make derivation explicit. For example: -- --
--   data Foo = Foo
--        deriving Generic
--        deriving Eq via Generically Foo
--   
module Language.Haskell.Liquid.Types.Generics newtype Generically a Generically :: a -> Generically a -- | Generic (==). -- --
--   instance Eq MyType where
--     (==) = geq
--   
geq :: (Generic a, Eq (Rep a ())) => a -> a -> Bool -- | A helper for better type inference. from' :: Generic a => a -> Rep a () to' :: Generic a => Rep a () -> a instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Generics.Generically a) instance (GHC.Generics.Generic a, Data.Hashable.Class.GHashable Data.Hashable.Class.Zero (GHC.Generics.Rep a)) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Generics.Generically a) instance (GHC.Generics.Generic a, Data.Binary.Class.GBinaryPut (GHC.Generics.Rep a), Data.Binary.Class.GBinaryGet (GHC.Generics.Rep a)) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Generics.Generically a) instance (GHC.Generics.Generic a, GHC.Classes.Eq (GHC.Generics.Rep a ())) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Generics.Generically a) module Language.Haskell.Liquid.Types.Names lenLocSymbol :: Located Symbol anyTypeSymbol :: Symbol functionComposisionSymbol :: Symbol module Language.Haskell.Liquid.Types.Variance data Variance Invariant :: Variance Bivariant :: Variance Contravariant :: Variance Covariant :: Variance type VarianceInfo = [Variance] instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Variance.Variance instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Variance.Variance instance GHC.Show.Show Language.Haskell.Liquid.Types.Variance.Variance instance Data.Data.Data Language.Haskell.Liquid.Types.Variance.Variance instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Variance.Variance instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Variance.Variance instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Variance.Variance instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Variance.Variance -- | Command Line Configuration Options -- ---------------------------------------- module Language.Haskell.Liquid.UX.Config data Config Config :: Verbosity -> [FilePath] -> [FilePath] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Int -> Bool -> Bool -> [String] -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> Bool -> Maybe Int -> Int -> Int -> Int -> Maybe SMTSolver -> Bool -> Bool -> Bool -> [String] -> [String] -> Eliminate -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> Int -> Int -> Maybe Int -> Bool -> Config -- | the logging verbosity to use (defaults to Quiet) [loggingVerbosity] :: Config -> Verbosity -- | source files to check [files] :: Config -> [FilePath] -- | path to directory for including specs [idirs] :: Config -> [FilePath] -- | check subset of binders modified (+ dependencies) since last check [diffcheck] :: Config -> Bool -- | uninterpreted integer multiplication and division [linear] :: Config -> Bool -- | interpretation of string theory in the logic [stringTheory] :: Config -> Bool -- | allow higher order binders into the logic [higherorder] :: Config -> Bool -- | allow higher order qualifiers [higherorderqs] :: Config -> Bool -- | smt timeout [smtTimeout] :: Config -> Maybe Int -- | check all binders (overrides diffcheck) [fullcheck] :: Config -> Bool -- | save fixpoint query [saveQuery] :: Config -> Bool -- | set of binders to check [checks] :: Config -> [String] -- | whether to complain about specifications for unexported and unused -- values [noCheckUnknown] :: Config -> Bool -- | disable termination check [notermination] :: Config -> Bool -- | Adds precise reasoning on presence of rankNTypes [rankNTypes] :: Config -> Bool -- | disable checking class instances , structuralTerm :: Bool -- ^ use -- structural termination checker [noclasscheck] :: Config -> Bool -- | disable structural termination check [nostructuralterm] :: Config -> Bool -- | enable gradual type checking [gradual] :: Config -> Bool -- | scope of the outer binders on the inner refinements [bscope] :: Config -> Bool -- | depth of gradual concretization [gdepth] :: Config -> Int -- | interactive gradual solving [ginteractive] :: Config -> Bool -- | Check for termination and totality, Overrides no-termination flags [totalHaskell] :: Config -> Bool -- | disable warnings output (only show errors) [nowarnings] :: Config -> Bool -- | disable creation of intermediate annotation files [noannotations] :: Config -> Bool -- | check internal (GHC-derived) binders [checkDerived] :: Config -> Bool -- | maximum case expand nesting depth. [caseExpandDepth] :: Config -> Int -- | disable truing top level types [notruetypes] :: Config -> Bool -- | disable totality check in definitions [nototality] :: Config -> Bool -- | enable prunning unsorted Refinements [pruneUnsorted] :: Config -> Bool -- | number of cores used to solve constraints [cores] :: Config -> Maybe Int -- | Minimum size of a partition [minPartSize] :: Config -> Int -- | Maximum size of a partition. Overrides minPartSize [maxPartSize] :: Config -> Int -- | the maximum number of parameters to accept when mining qualifiers [maxParams] :: Config -> Int -- | name of smtsolver to use [default: try z3, cvc4, mathsat in order] [smtsolver] :: Config -> Maybe SMTSolver -- | drop module qualifers from pretty-printed names. [shortNames] :: Config -> Bool -- | don't show subtyping errors and contexts. [shortErrors] :: Config -> Bool -- | find and use .cabal file to include paths to sources for imported -- modules [cabalDir] :: Config -> Bool -- | command-line options to pass to GHC [ghcOptions] :: Config -> [String] -- | .c files to compile and link against (for GHC) [cFiles] :: Config -> [String] -- | eliminate (i.e. don't use qualifs for) for "none", "cuts" or "all" -- kvars [eliminate] :: Config -> Eliminate -- | port at which lhi should listen [port] :: Config -> Int -- | Automatically generate singleton types for data constructors [exactDC] :: Config -> Bool -- | Disable ADTs (only used with exactDC) [noADT] :: Config -> Bool -- | scrape qualifiers from imported specifications [scrapeImports] :: Config -> Bool -- | scrape qualifiers from auto specifications [scrapeInternals] :: Config -> Bool -- | scrape qualifiers from used, imported specifications [scrapeUsedImports] :: Config -> Bool -- | print eliminate stats [elimStats] :: Config -> Bool -- | eliminate upto given depth of KVar chains [elimBound] :: Config -> Maybe Int -- | print results (safe/errors) as JSON [json] :: Config -> Bool -- | attempt to generate counter-examples to type errors [counterExamples] :: Config -> Bool -- | check and time each (asserted) type-sig separately [timeBinds] :: Config -> Bool -- | treat code patterns (e.g. e1 >>= x -> e2) specially for -- inference [noPatternInline] :: Config -> Bool -- | print full blown core (with untidy names) in verbose mode [untidyCore] :: Config -> Bool -- | simplify GHC core before constraint-generation PLE-OPT , autoInst -- ntiate :: Instantiate -- ^ How to instantiate axioms [noSimplifyCore] :: Config -> Bool -- | Disable non-concrete KVar slicing [noslice] :: Config -> Bool -- | Disable loading lifted specifications (for "legacy" libs) [noLiftedImport] :: Config -> Bool -- | Enable proof-by-logical-evaluation [proofLogicEval] :: Config -> Bool -- | Enable proof-by-logical-evaluation [oldPLE] :: Config -> Bool -- | Enable proof-by-logical-evaluation locally, per function [proofLogicEvalLocal] :: Config -> Bool -- | Enable extensional interpretation of function equality [extensionality] :: Config -> Bool -- | No inference of polymorphic type application. [nopolyinfer] :: Config -> Bool -- | Allow "reflection"; switches on "--higherorder" and "--exactdc" [reflection] :: Config -> Bool -- | Only "compile" the spec -- into .bspec file -- don't do any checking. [compileSpec] :: Config -> Bool -- | Do not check the transitive imports [noCheckImports] :: Config -> Bool -- | Warn about "typed-holes" [typedHoles] :: Config -> Bool [maxMatchDepth] :: Config -> Int [maxAppDepth] :: Config -> Int [maxArgsDepth] :: Config -> Int [maxRWOrderingConstraints] :: Config -> Maybe Int [rwTerminationCheck] :: Config -> Bool class HasConfig t getConfig :: HasConfig t => t -> Config allowPLE :: Config -> Bool allowLocalPLE :: Config -> Bool allowGlobalPLE :: Config -> Bool patternFlag :: HasConfig t => t -> Bool higherOrderFlag :: HasConfig t => t -> Bool pruneFlag :: HasConfig t => t -> Bool maxCaseExpand :: HasConfig t => t -> Int exactDCFlag :: HasConfig t => t -> Bool hasOpt :: HasConfig t => t -> (Config -> Bool) -> Bool totalityCheck :: HasConfig t => t -> Bool terminationCheck :: HasConfig t => t -> Bool structuralTerm :: HasConfig a => a -> Bool instance GHC.Classes.Eq Language.Haskell.Liquid.UX.Config.Config instance GHC.Show.Show Language.Haskell.Liquid.UX.Config.Config instance Data.Data.Data Language.Haskell.Liquid.UX.Config.Config instance GHC.Generics.Generic Language.Haskell.Liquid.UX.Config.Config instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.UX.Config.Config module Gradual.Types data GConfig GConfig :: String -> Int -> Int -> Int -> GConfig [gtarget] :: GConfig -> String [depth] :: GConfig -> Int [pId] :: GConfig -> Int [pNumber] :: GConfig -> Int defConfig :: GConfig setPId :: GConfig -> Int -> GConfig makeGConfig :: Config -> GConfig type GSub a = HashMap KVar (a, Expr) type GMap a = HashMap KVar (a, [Expr]) type GSpan = HashMap KVar [(KVar, Maybe SrcSpan)] toGMap :: [(KVar, (a, [Expr]))] -> GMap a fromGMap :: GMap a -> [(KVar, (a, [Expr]))] fromGSub :: GSub a -> [(KVar, (a, Expr))] removeInfo :: GMap a -> GMap () module Gradual.Uniquify -- | Make each gradual appearance unique -- ------------------------------------- uniquify :: (NFData a, Fixpoint a, Loc a) => SInfo a -> (GSpan, SInfo a) instance Gradual.Uniquify.Unique a => Gradual.Uniquify.Unique (Data.HashMap.Internal.HashMap Language.Fixpoint.Types.Constraints.SubcId a) instance Language.Fixpoint.Types.Spans.Loc a => Gradual.Uniquify.Unique (Language.Fixpoint.Types.Constraints.SimpC a) instance Gradual.Uniquify.Unique Language.Fixpoint.Types.Environments.IBindEnv instance Gradual.Uniquify.Unique Language.Fixpoint.Types.Environments.BindId instance Gradual.Uniquify.Unique Language.Fixpoint.Types.Refinements.SortedReft instance Gradual.Uniquify.Unique Language.Fixpoint.Types.Refinements.Reft instance Gradual.Uniquify.Unique Language.Fixpoint.Types.Refinements.Expr module Gradual.Refinements makeGMap :: GConfig -> Config -> SInfo a -> [(KVar, (GWInfo, [Expr]))] -> IO (GMap GWInfo) module Gradual.Concretize class Gradual a concretize :: Gradual a => GMap GWInfo -> a -> [(GSub GWInfo, a)] instance Gradual.Concretize.Gradual (Language.Fixpoint.Types.Constraints.SInfo a) instance Gradual.Concretize.GSubable Language.Fixpoint.Types.Environments.BindEnv instance Gradual.Concretize.GSubable (Language.Fixpoint.Types.Constraints.SimpC a) instance Gradual.Concretize.GSubable v => Gradual.Concretize.GSubable (Data.HashMap.Internal.HashMap Language.Fixpoint.Types.Constraints.SubcId v) instance Gradual.Concretize.GSubable Language.Fixpoint.Types.Refinements.SortedReft instance Gradual.Concretize.GSubable Language.Fixpoint.Types.Refinements.Reft module Paths_liquidhaskell version :: Version getBinDir :: IO FilePath getLibDir :: IO FilePath getDynLibDir :: IO FilePath getDataDir :: IO FilePath getLibexecDir :: IO FilePath getDataFileName :: FilePath -> IO FilePath getSysconfDir :: IO FilePath module Language.Haskell.Liquid.Misc type Nat = Int (.&&.) :: (a -> Bool) -> (a -> Bool) -> a -> Bool (.||.) :: (a -> Bool) -> (a -> Bool) -> a -> Bool up :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d timedAction :: Show msg => Maybe msg -> IO a -> IO a (!?) :: [a] -> Int -> Maybe a safeFromJust :: String -> Maybe t -> t safeFromLeft :: String -> Either a b -> a takeLast :: Int -> [a] -> [a] getNth :: Int -> [a] -> Maybe a fst4 :: (t, t1, t2, t3) -> t snd4 :: (t, t1, t2, t3) -> t1 thrd3 :: (t1, t2, t3) -> t3 mapFourth4 :: (t -> t4) -> (t1, t2, t3, t) -> (t1, t2, t3, t4) addFst3 :: t -> (t1, t2) -> (t, t1, t2) addThd3 :: t2 -> (t, t1) -> (t, t1, t2) dropFst3 :: (t, t1, t2) -> (t1, t2) dropThd3 :: (t1, t2, t) -> (t1, t2) replaceN :: (Enum a, Eq a, Num a) => a -> t -> [t] -> [t] fourth4 :: (t, t1, t2, t3) -> t3 third4 :: (t, t1, t2, t3) -> t2 mapSndM :: Applicative m => (b -> m c) -> (a, b) -> m (a, c) firstM :: Functor f => (t -> f a) -> (t, t1) -> f (a, t1) secondM :: Functor f => (t -> f a) -> (t1, t) -> f (t1, a) first3M :: Functor f => (t -> f a) -> (t, t1, t2) -> f (a, t1, t2) second3M :: Functor f => (t -> f a) -> (t1, t, t2) -> f (t1, a, t2) third3M :: Functor f => (t -> f a) -> (t1, t2, t) -> f (t1, t2, a) third3 :: (t -> t3) -> (t1, t2, t) -> (t1, t2, t3) zip4 :: [t] -> [t1] -> [t2] -> [t3] -> [(t, t1, t2, t3)] isIncludeFile :: FilePath -> FilePath -> Bool getIncludeDir :: IO FilePath getCssPath :: IO FilePath getCoreToLogicPath :: IO FilePath zipMaybe :: [a] -> [b] -> Maybe [(a, b)] safeZipWithError :: String -> [t] -> [t1] -> [(t, t1)] safeZip3WithError :: String -> [t] -> [t1] -> [t2] -> [(t, t1, t2)] mapNs :: (Eq a, Num a, Foldable t) => t a -> (a1 -> a1) -> [a1] -> [a1] mapN :: (Eq a, Num a) => a -> (a1 -> a1) -> [a1] -> [a1] zipWithDefM :: Monad m => (a -> a -> m a) -> [a] -> [a] -> m [a] zipWithDef :: (a -> a -> a) -> [a] -> [a] -> [a] single :: t -> [t] mapFst3 :: (t -> t1) -> (t, t2, t3) -> (t1, t2, t3) mapSnd3 :: (t -> t2) -> (t1, t, t3) -> (t1, t2, t3) mapThd3 :: (t -> t3) -> (t1, t2, t) -> (t1, t2, t3) firstMaybes :: [Maybe a] -> Maybe a fromFirstMaybes :: a -> [Maybe a] -> a hashMapMapWithKey :: (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2 hashMapMapKeys :: (Eq k2, Hashable k2) => (k1 -> k2) -> HashMap k1 v -> HashMap k2 v concatMapM :: (Monad m, Traversable t) => (a -> m [b]) -> t a -> m [b] replaceSubset :: (Eq k, Hashable k) => [(k, a)] -> [(k, a)] -> [(k, a)] replaceWith :: (Eq a, Hashable a) => (b -> a) -> [b] -> [b] -> [b] firstElems :: [(ByteString, ByteString)] -> ByteString -> Maybe (Int, ByteString, (ByteString, ByteString)) splitters :: [(ByteString, t)] -> ByteString -> [(Int, t, (ByteString, ByteString))] bchopAlts :: [(ByteString, ByteString)] -> ByteString -> [ByteString] chopAlts :: [(String, String)] -> String -> [String] sortDiff :: Ord a => [a] -> [a] -> [a] (<->) :: Doc -> Doc -> Doc angleBrackets :: Doc -> Doc mkGraph :: (Eq a, Eq b, Hashable a, Hashable b) => [(a, b)] -> HashMap a (HashSet b) tryIgnore :: String -> IO () -> IO () condNull :: Monoid m => Bool -> m -> m firstJust :: (a -> Maybe b) -> [a] -> Maybe b intToString :: Int -> String mapAccumM :: (Monad m, Traversable t) => (a -> b -> m (a, c)) -> a -> t b -> m (a, t c) ifM :: Monad m => m Bool -> m b -> m b -> m b nubHashOn :: (Eq k, Hashable k) => (a -> k) -> [a] -> [a] nubHashLast :: (Eq k, Hashable k) => (a -> k) -> [a] -> [a] nubHashLastM :: (Eq k, Hashable k, Monad m) => (a -> m k) -> [a] -> m [a] uniqueByKey :: (Eq k, Hashable k) => [(k, v)] -> Either (k, [v]) [v] uniqueByKey' :: (Eq k, Hashable k) => ((k, [v]) -> Either e v) -> [(k, v)] -> Either e [v] join :: (Eq b, Hashable b) => [(a, b)] -> [(b, c)] -> [(a, c)] fstByRank :: (Ord r, Hashable k, Eq k) => [(r, k, v)] -> [(r, k, v)] sortOn :: Ord b => (a -> b) -> [a] -> [a] firstGroup :: (Eq k, Ord k, Hashable k) => [(k, a)] -> [a] keyDiff :: (Eq k, Hashable k) => (a -> k) -> [a] -> [a] -> [a] concatUnzip :: [([a], [b])] -> ([a], [b]) sayReadFile :: FilePath -> IO String lastModified :: FilePath -> IO (Maybe UTCTime) -- | This module contains the *types* related creating Errors. It depends -- only on Fixpoint and basic haskell libraries, and hence, should be -- importable everywhere. module Language.Haskell.Liquid.Types.Errors -- | Generic Type for Error Messages -- ------------------------------------------- -- -- INVARIANT : all Error constructors should have a pos field data TError t -- | liquid type error ErrSubType :: !SrcSpan -> !Doc -> !HashMap Symbol t -> !t -> !t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [ctx] :: TError t -> !HashMap Symbol t [tact] :: TError t -> !t [texp] :: TError t -> !t -- | liquid type error with a counter-example ErrSubTypeModel :: !SrcSpan -> !Doc -> !HashMap Symbol (WithModel t) -> !WithModel t -> !t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [ctxM] :: TError t -> !HashMap Symbol (WithModel t) [tactM] :: TError t -> !WithModel t [texp] :: TError t -> !t -- | liquid type error ErrFCrash :: !SrcSpan -> !Doc -> !HashMap Symbol t -> !t -> !t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [ctx] :: TError t -> !HashMap Symbol t [tact] :: TError t -> !t [texp] :: TError t -> !t -- | hole type ErrHole :: !SrcSpan -> !Doc -> !HashMap Symbol t -> !Symbol -> !t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [ctx] :: TError t -> !HashMap Symbol t [svar] :: TError t -> !Symbol [thl] :: TError t -> !t -- | hole dependencies form a cycle error ErrHoleCycle :: !SrcSpan -> [Symbol] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [holesCycle] :: TError t -> [Symbol] -- | condition failure error ErrAssType :: !SrcSpan -> !Oblig -> !Doc -> !HashMap Symbol t -> t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [obl] :: TError t -> !Oblig [msg] :: TError t -> !Doc [ctx] :: TError t -> !HashMap Symbol t [cond] :: TError t -> t -- | specification parse error ErrParse :: !SrcSpan -> !Doc -> !ParseError -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [pErr] :: TError t -> !ParseError -- | sort error in specification ErrTySpec :: !SrcSpan -> !Maybe Doc -> !Doc -> !t -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [knd] :: TError t -> !Maybe Doc [var] :: TError t -> !Doc [typ] :: TError t -> !t [msg] :: TError t -> !Doc -- | sort error in specification ErrTermSpec :: !SrcSpan -> !Doc -> !Doc -> !Expr -> !t -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [msg] :: TError t -> !Doc [exp] :: TError t -> !Expr [typ] :: TError t -> !t [msg'] :: TError t -> !Doc -- | multiple alias with same name error ErrDupAlias :: !SrcSpan -> !Doc -> !Doc -> ![SrcSpan] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [kind] :: TError t -> !Doc [locs] :: TError t -> ![SrcSpan] -- | multiple specs for same binder error ErrDupSpecs :: !SrcSpan -> !Doc -> ![SrcSpan] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [locs] :: TError t -> ![SrcSpan] -- | multiple definitions of the same instance measure ErrDupIMeas :: !SrcSpan -> !Doc -> !Doc -> ![SrcSpan] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [tycon] :: TError t -> !Doc [locs] :: TError t -> ![SrcSpan] -- | multiple definitions of the same measure ErrDupMeas :: !SrcSpan -> !Doc -> ![SrcSpan] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [locs] :: TError t -> ![SrcSpan] -- | duplicate fields in same datacon ErrDupField :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [dcon] :: TError t -> !Doc [field] :: TError t -> !Doc -- | name resolves to multiple possible GHC vars ErrDupNames :: !SrcSpan -> !Doc -> ![Doc] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [names] :: TError t -> ![Doc] -- | bad data type specification (?) ErrBadData :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | bad data type specification (?) ErrBadGADT :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | refined datacon mismatches haskell datacon ErrDataCon :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Invariant sort error ErrInvt :: !SrcSpan -> !t -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [inv] :: TError t -> !t [msg] :: TError t -> !Doc -- | Using sort error ErrIAl :: !SrcSpan -> !t -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [inv] :: TError t -> !t [msg] :: TError t -> !Doc -- | Incompatible using error ErrIAlMis :: !SrcSpan -> !t -> !t -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [tAs] :: TError t -> !t [tUs] :: TError t -> !t [msg] :: TError t -> !Doc -- | Measure sort error ErrMeas :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [ms] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Haskell bad Measure error ErrHMeas :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [ms] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Unbound symbol in specification ErrUnbound :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc -- | Unbound predicate being applied ErrUnbPred :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc -- | GHC error: parsing or type checking ErrGhc :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc -- | Name resolution error ErrResolve :: !SrcSpan -> !Doc -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [kind] :: TError t -> !Doc [var] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Mismatch between Liquid and Haskell types ErrMismatch :: !SrcSpan -> !Doc -> !Doc -> !Doc -> !Doc -> !Maybe (Doc, Doc) -> !SrcSpan -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [msg] :: TError t -> !Doc [hs] :: TError t -> !Doc [lqTy] :: TError t -> !Doc -- | specific pair of things that mismatch [diff] :: TError t -> !Maybe (Doc, Doc) -- | lq type location [lqPos] :: TError t -> !SrcSpan -- | Mismatch in expected/actual args of abstract refinement ErrPartPred :: !SrcSpan -> !Doc -> !Doc -> !Int -> !Int -> !Int -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [ectr] :: TError t -> !Doc [var] :: TError t -> !Doc [argN] :: TError t -> !Int [expN] :: TError t -> !Int [actN] :: TError t -> !Int -- | Cyclic Refined Type Alias Definitions ErrAliasCycle :: !SrcSpan -> ![(SrcSpan, Doc)] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [acycle] :: TError t -> ![(SrcSpan, Doc)] -- | Illegal RTAlias application (from BSort, eg. in PVar) ErrIllegalAliasApp :: !SrcSpan -> !Doc -> !SrcSpan -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [dname] :: TError t -> !Doc [dpos] :: TError t -> !SrcSpan ErrAliasApp :: !SrcSpan -> !Doc -> !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [dname] :: TError t -> !Doc [dpos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc -- | Termination Error ErrTermin :: !SrcSpan -> ![Doc] -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [bind] :: TError t -> ![Doc] [msg] :: TError t -> !Doc -- | Termination Error ErrStTerm :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [dname] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Instance Law Error ErrILaw :: !SrcSpan -> !Doc -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [cname] :: TError t -> !Doc [iname] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Refined Class/Interfaces Conflict ErrRClass :: !SrcSpan -> !Doc -> ![(SrcSpan, Doc)] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [cls] :: TError t -> !Doc [insts] :: TError t -> ![(SrcSpan, Doc)] -- | Standalone class method refinements ErrMClass :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc -- | Non well sorted Qualifier ErrBadQual :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [qname] :: TError t -> !Doc [msg] :: TError t -> !Doc -- | Previously saved error, that carries over after DiffCheck ErrSaved :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [nam] :: TError t -> !Doc [msg] :: TError t -> !Doc ErrFilePragma :: !SrcSpan -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan ErrTyCon :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [tcname] :: TError t -> !Doc ErrLiftExp :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc ErrParseAnn :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc ErrNoSpec :: !SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [srcF] :: TError t -> !Doc [bspF] :: TError t -> !Doc ErrFail :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc ErrFailUsed :: !SrcSpan -> !Doc -> ![Doc] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [clients] :: TError t -> ![Doc] ErrRewrite :: !SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc -- | Sigh. Other. ErrOther :: SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> SrcSpan [msg] :: TError t -> !Doc -- | Context information for Error Messages -- ------------------------------------ data CtxError t CtxError :: TError t -> Doc -> CtxError t [ctErr] :: CtxError t -> TError t [ctCtx] :: CtxError t -> Doc errorsWithContext :: [TError Doc] -> IO [CtxError Doc] -- | Different kinds of Check Obligations -- ------------------------------------ data Oblig -- | Obligation that proves termination OTerm :: Oblig -- | Obligation that proves invariants OInv :: Oblig -- | Obligation that proves subtyping constraints OCons :: Oblig data WithModel t NoModel :: t -> WithModel t WithModel :: !Doc -> t -> WithModel t dropModel :: WithModel t -> t -- | Simple unstructured type for panic -- ---------------------------------------- type UserError = TError Doc -- | Construct and show an Error, then crash panic :: Maybe SrcSpan -> String -> a -- | Construct and show an Error, then crash panicDoc :: SrcSpan -> Doc -> a -- | Construct and show an Error with an optional SrcSpan, then crash This -- function should be used to mark unimplemented functionality todo :: Maybe SrcSpan -> String -> a -- | Construct and show an Error with an optional SrcSpan, then crash This -- function should be used to mark impossible-to-reach codepaths impossible :: Maybe SrcSpan -> String -> a -- | Construct and show an Error, then crash uError :: UserError -> a -- | Convert a GHC error into a list of our errors. sourceErrors :: String -> SourceError -> [TError t] errDupSpecs :: Doc -> ListNE SrcSpan -> TError t ppError :: (PPrint a, Show a) => Tidy -> Doc -> TError a -> Doc ppTicks :: PPrint a => a -> Doc realSrcSpan :: FilePath -> Int -> Int -> Int -> Int -> RealSrcSpan unpackRealSrcSpan :: RealSrcSpan -> (String, Int, Int, Int, Int) srcSpanFileMb :: SrcSpan -> Maybe FilePath instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Errors.Oblig instance Data.Data.Data Language.Haskell.Liquid.Types.Errors.Oblig instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Errors.Oblig instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Errors.Oblig instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Errors.WithModel t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Errors.WithModel t) instance GHC.Show.Show t => GHC.Show.Show (Language.Haskell.Liquid.Types.Errors.WithModel t) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Errors.WithModel instance GHC.Base.Functor Language.Haskell.Liquid.Types.Errors.TError instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Errors.TError t) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Errors.CtxError instance GHC.Classes.Eq (Language.Haskell.Liquid.Types.Errors.CtxError t) instance GHC.Classes.Ord (Language.Haskell.Liquid.Types.Errors.CtxError t) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Errors.UserError instance GHC.Show.Show Language.Haskell.Liquid.Types.Errors.UserError instance GHC.Exception.Type.Exception Language.Haskell.Liquid.Types.Errors.UserError instance GHC.Classes.Eq (Language.Haskell.Liquid.Types.Errors.TError a) instance GHC.Classes.Ord (Language.Haskell.Liquid.Types.Errors.TError a) instance (Language.Fixpoint.Types.PrettyPrint.PPrint a, GHC.Show.Show a) => Data.Aeson.Types.ToJSON.ToJSON (Language.Haskell.Liquid.Types.Errors.TError a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.Haskell.Liquid.Types.Errors.TError a) instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Errors.WithModel t) instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Errors.Oblig instance GHC.Show.Show Language.Haskell.Liquid.Types.Errors.Oblig instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Errors.Oblig instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Errors.Oblig instance Language.Fixpoint.Types.PrettyPrint.PPrint Text.Parsec.Error.ParseError instance Control.DeepSeq.NFData Text.Parsec.Error.ParseError instance Language.Fixpoint.Types.PrettyPrint.PPrint SrcLoc.SrcSpan instance Data.Aeson.Types.ToJSON.ToJSON SrcLoc.RealSrcSpan instance Data.Aeson.Types.FromJSON.FromJSON SrcLoc.RealSrcSpan instance Data.Aeson.Types.ToJSON.ToJSON SrcLoc.SrcSpan instance Data.Aeson.Types.FromJSON.FromJSON SrcLoc.SrcSpan instance Data.Aeson.Types.ToJSON.ToJSONKey SrcLoc.SrcSpan instance Data.Aeson.Types.FromJSON.FromJSONKey SrcLoc.SrcSpan -- | This module exposes variations over the standard GHC's logging -- functions to work with the Doc type from the "pretty" -- package. We would like LiquidHaskell to emit diagnostic messages using -- the very same GHC machinery, so that IDE-like programs (e.g. "ghcid", -- "ghcide" etc) would be able to correctly show errors and warnings to -- the users, in ther editors. -- -- Unfortunately, this is not possible to do out of the box because -- LiquidHaskell uses the Doc type from the "pretty" package but -- GHC uses (for historical reasons) its own version. Due to the fact -- none of the constructors are exported, we simply cannot convert -- between the two types effortlessly, but we have to pay the price of a -- pretty-printing "roundtrip". module Language.Haskell.Liquid.GHC.Logging fromPJDoc :: Doc -> SDoc -- | Like the original putLogMsg, but internally converts the input -- Doc (from the "pretty" library) into GHC's internal -- SDoc. putLogMsg :: DynFlags -> WarnReason -> Severity -> SrcSpan -> Maybe PprStyle -> Doc -> IO () putWarnMsg :: DynFlags -> SrcSpan -> Doc -> IO () putErrMsg :: DynFlags -> SrcSpan -> Doc -> IO () -- | Like putErrMsg, but it uses GHC's internal Doc. This -- can be very convenient when logging things which comes directly from -- GHC rather than LiquidHaskell. putErrMsg' :: DynFlags -> SrcSpan -> SDoc -> IO () -- | Like GHC's mkLongErrAt, but it builds the final ErrMsg -- out of two "HughesPJ"'s Docs. mkLongErrAt :: SrcSpan -> Doc -> Doc -> TcRn ErrMsg -- | This module contains a wrappers and utility functions for accessing -- GHC module information. It should NEVER depend on ANY module inside -- the Language.Haskell.Liquid.* tree. module Language.Haskell.Liquid.GHC.Misc isAnonBinder :: TyConBinder -> Bool mkAlive :: Var -> Id -- | Encoding and Decoding Location -- -------------------------------------------- srcSpanTick :: Module -> SrcSpan -> Tickish a tickSrcSpan :: Outputable a => Tickish a -> SrcSpan -- | Generic Helpers for Accessing GHC Innards -- --------------------------------- stringTyVar :: String -> TyVar stringVar :: String -> Type -> Var stringTyCon :: Char -> Int -> String -> TyCon stringTyConWithKind :: Kind -> Char -> Int -> String -> TyCon hasBaseTypeVar :: Var -> Bool isBaseType :: Type -> Bool isTmpVar :: Var -> Bool isTmpSymbol :: Symbol -> Bool validTyVar :: String -> Bool tvId :: TyVar -> String tidyCBs :: [CoreBind] -> [CoreBind] unTick :: CoreBind -> CoreBind unTickExpr :: CoreExpr -> CoreExpr isFractionalClass :: Class -> Bool -- | Pretty Printers -- ----------------------------------------------------------- notracePpr :: Outputable a => String -> a -> a tracePpr :: Outputable a => String -> a -> a pprShow :: Show a => a -> SDoc toFixSDoc :: Fixpoint a => a -> Doc sDocDoc :: SDoc -> Doc pprDoc :: Outputable a => a -> Doc showPpr :: Outputable a => a -> String showSDoc :: SDoc -> String myQualify :: PrintUnqualified showSDocDump :: SDoc -> String typeUniqueString :: Outputable a => a -> String -- | Manipulating Source Spans -- ------------------------------------------------- newtype Loc L :: (Int, Int) -> Loc fSrcSpan :: Loc a => a -> SrcSpan fSourcePos :: Loc a => a -> SourcePos fSrcSpanSrcSpan :: SrcSpan -> SrcSpan srcSpanFSrcSpan :: SrcSpan -> SrcSpan sourcePos2SrcSpan :: SourcePos -> SourcePos -> SrcSpan sourcePosSrcSpan :: SourcePos -> SrcSpan sourcePosSrcLoc :: SourcePos -> SrcLoc srcSpanSourcePos :: SrcSpan -> SourcePos srcSpanSourcePosE :: SrcSpan -> SourcePos srcSpanFilename :: SrcSpan -> String srcSpanStartLoc :: RealSrcSpan -> Loc srcSpanEndLoc :: RealSrcSpan -> Loc oneLine :: RealSrcSpan -> Bool lineCol :: RealSrcSpan -> (Int, Int) realSrcSpanSourcePos :: RealSrcSpan -> SourcePos realSrcSpanSourcePosE :: RealSrcSpan -> SourcePos getSourcePos :: NamedThing a => a -> SourcePos getSourcePosE :: NamedThing a => a -> SourcePos locNamedThing :: NamedThing a => a -> Located a namedLocSymbol :: (Symbolic a, NamedThing a) => a -> Located Symbol varLocInfo :: (Type -> a) -> Var -> Located a namedPanic :: NamedThing a => a -> String -> b -- | Manipulating CoreExpr -- ----------------------------------------------------- collectArguments :: Int -> CoreExpr -> [Var] collectValBinders' :: Expr Var -> ([Var], Expr Var) ignoreLetBinds :: Expr t -> Expr t -- | Predicates on CoreExpr and DataCons -- --------------------------------------- isTupleId :: Id -> Bool idDataConM :: Id -> Maybe DataCon isDataConId :: Id -> Bool getDataConVarUnique :: Var -> Unique isDictionaryExpression :: Expr Id -> Maybe Id realTcArity :: TyCon -> Arity kindTCArity :: TyCon -> Arity kindArity :: Kind -> Arity uniqueHash :: Uniquable a => Int -> a -> Int lookupRdrName :: HscEnv -> ModuleName -> RdrName -> IO (Maybe Name) ignoreInline :: ParsedModule -> ParsedModule -- | Symbol Conversions -- -------------------------------------------------------- symbolTyConWithKind :: Kind -> Char -> Int -> Symbol -> TyCon symbolTyCon :: Char -> Int -> Symbol -> TyCon symbolTyVar :: Symbol -> TyVar localVarSymbol :: Var -> Symbol exportedVarSymbol :: Var -> Symbol qualifiedNameSymbol :: Name -> Symbol fastStringText :: FastString -> Text tyConTyVarsDef :: TyCon -> [TyVar] noTyVars :: TyCon -> Bool -- | Manipulating Symbols -- ------------------------------------------------------ splitModuleName :: Symbol -> (Symbol, Symbol) dropModuleNamesAndUnique :: Symbol -> Symbol dropModuleNames :: Symbol -> Symbol dropModuleNamesCorrect :: Symbol -> Symbol takeModuleNames :: Symbol -> Symbol dropModuleUnique :: Symbol -> Symbol cmpSymbol :: Symbol -> Symbol -> Bool sepModNames :: Text sepUnique :: Text mungeNames :: (String -> [Text] -> Symbol) -> Text -> String -> Symbol -> Symbol qualifySymbol :: Symbol -> Symbol -> Symbol isQualifiedSym :: Symbol -> Bool isQualified :: Text -> Bool wrapParens :: (IsString a, Monoid a) => a -> a isParened :: Text -> Bool isDictionary :: Symbolic a => a -> Bool isMethod :: Symbolic a => a -> Bool isInternal :: Symbolic a => a -> Bool isWorker :: Symbolic a => a -> Bool stripParens :: Text -> Text stripParensSym :: Symbol -> Symbol desugarModule :: TypecheckedModule -> Ghc DesugaredModule -- | GHC Compatibility Layer -- --------------------------------------------------- gHC_VERSION :: String symbolFastString :: Symbol -> FastString lintCoreBindings :: [Var] -> CoreProgram -> (Bag MsgDoc, Bag MsgDoc) synTyConRhs_maybe :: TyCon -> Maybe Type tcRnLookupRdrName :: HscEnv -> Located RdrName -> IO (Messages, Maybe [Name]) showCBs :: Bool -> [CoreBind] -> String ignoreCoreBinds :: HashSet Var -> [CoreBind] -> [CoreBind] findVarDef :: Symbol -> [CoreBind] -> Maybe (Var, CoreExpr) coreBindSymbols :: CoreBind -> [Symbol] simplesymbol :: NamedThing t => t -> Symbol binders :: Bind a -> [a] expandVarType :: Var -> Type -- | The following functions test if a CoreExpr or CoreVar -- are just types in disguise, e.g. have PredType (in the GHC -- sense of the word), and so shouldn't appear in refinements. isPredExpr :: CoreExpr -> Bool isPredVar :: Var -> Bool isPredType :: Type -> Bool anyF :: [a -> Bool] -> a -> Bool -- | 'defaultDataCons t ds' returns the list of '(dc, types)' pairs, -- corresponding to the _missing_ cases, i.e. _other_ than those in -- ds, that are being handled by DEFAULT. defaultDataCons :: Type -> [AltCon] -> Maybe [(DataCon, [TyVar], [Type])] isEvVar :: Id -> Bool instance GHC.Show.Show Language.Haskell.Liquid.GHC.Misc.Loc instance GHC.Classes.Ord Language.Haskell.Liquid.GHC.Misc.Loc instance GHC.Classes.Eq Language.Haskell.Liquid.GHC.Misc.Loc instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.GHC.Misc.Loc instance Outputable.Outputable a => Outputable.Outputable (Data.HashSet.Internal.HashSet a) instance Data.Hashable.Class.Hashable SrcLoc.SrcSpan instance Language.Fixpoint.Types.Spans.Loc Var.Var instance Language.Fixpoint.Types.Names.Symbolic FastString.FastString instance Language.Fixpoint.Types.Names.Symbolic TyCon.TyCon instance Language.Fixpoint.Types.Names.Symbolic Class.Class instance Language.Fixpoint.Types.Names.Symbolic Name.Name instance Language.Fixpoint.Types.Names.Symbolic Var.Var instance Data.Hashable.Class.Hashable Var.Var instance Data.Hashable.Class.Hashable TyCon.TyCon instance Data.Hashable.Class.Hashable DataCon.DataCon instance Language.Fixpoint.Types.PrettyPrint.Fixpoint Var.Var instance Language.Fixpoint.Types.PrettyPrint.Fixpoint Name.Name instance Language.Fixpoint.Types.PrettyPrint.Fixpoint TyCoRep.Type instance GHC.Show.Show Name.Name instance GHC.Show.Show Var.Var instance GHC.Show.Show Class.Class instance GHC.Show.Show TyCon.TyCon instance Control.DeepSeq.NFData Class.Class instance Control.DeepSeq.NFData TyCon.TyCon instance Control.DeepSeq.NFData TyCoRep.Type instance Control.DeepSeq.NFData Var.Var -- | Formats Haskell source code as HTML with CSS and Mouseover Type -- Annotations module Language.Haskell.Liquid.UX.ACSS -- | Formats Haskell source code using HTML and mouse-over annotations hscolour :: Bool -> Bool -> String -> String -- | Formats Haskell source code using HTML and mouse-over annotations hsannot :: Bool -> CommentTransform -> Bool -> (String, AnnMap) -> String data AnnMap Ann :: HashMap Loc (String, String) -> [(Loc, Loc, String)] -> !Status -> ![(RealSrcSpan, (String, String))] -> AnnMap -- | Loc -> (Var, Type) [types] :: AnnMap -> HashMap Loc (String, String) -- | List of error intervals [errors] :: AnnMap -> [(Loc, Loc, String)] [status] :: AnnMap -> !Status -- | Type information with spans [sptypes] :: AnnMap -> ![(RealSrcSpan, (String, String))] breakS :: [Char] srcModuleName :: String -> String data Status Safe :: Status Unsafe :: Status Error :: Status Crash :: Status tokeniseWithLoc :: CommentTransform -> String -> [(TokenType, String, Loc)] instance GHC.Show.Show Language.Haskell.Liquid.UX.ACSS.Status instance GHC.Classes.Ord Language.Haskell.Liquid.UX.ACSS.Status instance GHC.Classes.Eq Language.Haskell.Liquid.UX.ACSS.Status instance GHC.Show.Show Language.Haskell.Liquid.UX.ACSS.Annotation instance GHC.Show.Show Language.Haskell.Liquid.UX.ACSS.Lit instance GHC.Show.Show Language.Haskell.Liquid.UX.ACSS.AnnMap module Language.Haskell.Liquid.Types.Visitors class CBVisitable a freeVars :: CBVisitable a => HashSet Var -> a -> [Var] readVars :: CBVisitable a => a -> [Var] letVars :: CBVisitable a => a -> [Var] literals :: CBVisitable a => a -> [Literal] coreVisitor :: CoreVisitor env acc -> env -> acc -> [CoreBind] -> acc -- | BindVisitor allows for generic, context sensitive traversals -- over the CoreBinds data CoreVisitor env acc CoreVisitor :: (env -> Var -> env) -> (env -> acc -> Var -> acc) -> (env -> acc -> CoreExpr -> acc) -> CoreVisitor env acc [envF] :: CoreVisitor env acc -> env -> Var -> env [bindF] :: CoreVisitor env acc -> env -> acc -> Var -> acc [exprF] :: CoreVisitor env acc -> env -> acc -> CoreExpr -> acc instance Language.Haskell.Liquid.Types.Visitors.CBVisitable [CoreSyn.CoreBind] instance Language.Haskell.Liquid.Types.Visitors.CBVisitable CoreSyn.CoreBind instance Language.Haskell.Liquid.Types.Visitors.CBVisitable (CoreSyn.Expr Var.Var) instance Language.Haskell.Liquid.Types.Visitors.CBVisitable (CoreSyn.Alt Var.Var) instance Language.Haskell.Liquid.Types.Visitors.CBVisitable CoreSyn.AltCon -- | This module should contain all the global type definitions and basic -- instances. module Language.Haskell.Liquid.Types.Types -- | Which Top-Level Binders Should be Verified data TargetVars AllVars :: TargetVars Only :: ![Var] -> TargetVars -- | Information about Type Constructors data TyConMap TyConMap :: HashMap TyCon RTyCon -> HashMap (TyCon, [Sort]) RTyCon -> HashMap TyCon Int -> TyConMap -- | Map from GHC TyCon to RTyCon [tcmTyRTy] :: TyConMap -> HashMap TyCon RTyCon -- | Map from GHC Family-Instances to RTyCon [tcmFIRTy] :: TyConMap -> HashMap (TyCon, [Sort]) RTyCon -- | Arity of each Family-Tycon [tcmFtcArity] :: TyConMap -> HashMap TyCon Int data Located a Loc :: !SourcePos -> !SourcePos -> !a -> Located a [loc] :: Located a -> !SourcePos [locE] :: Located a -> !SourcePos [val] :: Located a -> !a dummyLoc :: a -> Located a type LocSymbol = Located Symbol type LocText = Located Text dummyName :: Symbol isDummy :: Symbolic a => a -> Bool data BTyCon BTyCon :: !LocSymbol -> !Bool -> !Bool -> BTyCon -- | TyCon name with location information [btc_tc] :: BTyCon -> !LocSymbol -- | Is this a class type constructor? [btc_class] :: BTyCon -> !Bool -- | Is Promoted Data Con? [btc_prom] :: BTyCon -> !Bool mkBTyCon :: LocSymbol -> BTyCon isClassBTyCon :: BTyCon -> Bool newtype BTyVar BTV :: Symbol -> BTyVar data RTyCon RTyCon :: TyCon -> ![RPVar] -> !TyConInfo -> RTyCon -- | Co- and Contra-variance for TyCon -------------------------------- -- -- Indexes start from 0 and type or predicate arguments can be both -- covariant and contravaariant e.g., for the below Foo dataType -- -- data Foo a b c d :: b - Prop, q :: Int -> Prop, r :: a -> -- Prop> = F (ar -> bp) | Q (c -> a) | G -- (Intq -> ar) -- -- there will be: -- -- varianceTyArgs = [Bivariant , Covariant, Contravatiant, Invariant] -- variancePsArgs = [Covariant, Contravatiant, Bivariant] data TyConInfo TyConInfo :: !VarianceInfo -> !VarianceInfo -> !Maybe SizeFun -> TyConInfo -- | variance info for type variables [varianceTyArgs] :: TyConInfo -> !VarianceInfo -- | variance info for predicate variables [variancePsArgs] :: TyConInfo -> !VarianceInfo -- | logical UNARY function that computes the size of the structure [sizeFunction] :: TyConInfo -> !Maybe SizeFun defaultTyConInfo :: TyConInfo rTyConPVs :: RTyCon -> [RPVar] rTyConPropVs :: RTyCon -> [PVar RSort] isClassType :: TyConable c => RType c t t1 -> Bool isEqType :: TyConable c => RType c t t1 -> Bool isRVar :: RType c tv r -> Bool -- | Accessors for RTyCon isBool :: RType RTyCon t t1 -> Bool data RType c tv r RVar :: !tv -> !r -> RType c tv r [rt_var] :: RType c tv r -> !tv [rt_reft] :: RType c tv r -> !r RFun :: !Symbol -> !RType c tv r -> !RType c tv r -> !r -> RType c tv r [rt_bind] :: RType c tv r -> !Symbol [rt_in] :: RType c tv r -> !RType c tv r [rt_out] :: RType c tv r -> !RType c tv r [rt_reft] :: RType c tv r -> !r RImpF :: !Symbol -> !RType c tv r -> !RType c tv r -> !r -> RType c tv r [rt_bind] :: RType c tv r -> !Symbol [rt_in] :: RType c tv r -> !RType c tv r [rt_out] :: RType c tv r -> !RType c tv r [rt_reft] :: RType c tv r -> !r RAllT :: !RTVU c tv -> !RType c tv r -> !r -> RType c tv r [rt_tvbind] :: RType c tv r -> !RTVU c tv [rt_ty] :: RType c tv r -> !RType c tv r [rt_ref] :: RType c tv r -> !r -- | "forall x y :: Nat, w :: Int . TYPE" ^^^^^^^^^^^^^^^^^^^ -- (rt_pvbind) RAllP :: !PVU c tv -> !RType c tv r -> RType c tv r [rt_pvbind] :: RType c tv r -> !PVU c tv [rt_ty] :: RType c tv r -> !RType c tv r -- | For example, in [a]- v > h}>, we apply (via RApp) -- * the RProp denoted by `{h -> v > h}` to * the -- RTyCon denoted by `[]`. RApp :: !c -> ![RType c tv r] -> ![RTProp c tv r] -> !r -> RType c tv r [rt_tycon] :: RType c tv r -> !c [rt_args] :: RType c tv r -> ![RType c tv r] [rt_pargs] :: RType c tv r -> ![RTProp c tv r] [rt_reft] :: RType c tv r -> !r RAllE :: !Symbol -> !RType c tv r -> !RType c tv r -> RType c tv r [rt_bind] :: RType c tv r -> !Symbol [rt_allarg] :: RType c tv r -> !RType c tv r [rt_ty] :: RType c tv r -> !RType c tv r REx :: !Symbol -> !RType c tv r -> !RType c tv r -> RType c tv r [rt_bind] :: RType c tv r -> !Symbol [rt_exarg] :: RType c tv r -> !RType c tv r [rt_ty] :: RType c tv r -> !RType c tv r -- | For expression arguments to type aliases see testsposvector2.hs RExprArg :: Located Expr -> RType c tv r RAppTy :: !RType c tv r -> !RType c tv r -> !r -> RType c tv r [rt_arg] :: RType c tv r -> !RType c tv r [rt_res] :: RType c tv r -> !RType c tv r [rt_reft] :: RType c tv r -> !r RRTy :: ![(Symbol, RType c tv r)] -> !r -> !Oblig -> !RType c tv r -> RType c tv r [rt_env] :: RType c tv r -> ![(Symbol, RType c tv r)] [rt_ref] :: RType c tv r -> !r [rt_obl] :: RType c tv r -> !Oblig [rt_ty] :: RType c tv r -> !RType c tv r -- | let LH match against the Haskell type and add k-vars, e.g. `x:_` see -- testsposHoles.hs RHole :: r -> RType c tv r -- | Ref describes `Prop τ` and HProp arguments applied -- to type constructors. For example, in [a]- v > h}>, we -- apply (via RApp) * the RProp denoted by `{h -> v > -- h}` to * the RTyCon denoted by `[]`. Thus, Ref is used -- for abstract-predicate (arguments) that are associated with _type -- constructors_ i.e. whose semantics are _dependent upon_ the data-type. -- In contrast, the Predicate argument in ur_pred in the -- UReft applies directly to any type and has semantics -- _independent of_ the data-type. data Ref τ t RProp :: [(Symbol, τ)] -> t -> Ref τ t [rf_args] :: Ref τ t -> [(Symbol, τ)] -- | Abstract refinement associated with RTyCon [rf_body] :: Ref τ t -> t -- | RTProp is a convenient alias for Ref that will save -- a bunch of typing. In general, perhaps we need not expose Ref -- directly at all. type RTProp c tv r = Ref (RType c tv ()) (RType c tv r) rPropP :: [(Symbol, τ)] -> r -> Ref τ (RType c tv r) newtype RTyVar RTV :: TyVar -> RTyVar -- | Refinement Type Aliases data RTAlias x a RTA :: Symbol -> [x] -> [Symbol] -> a -> RTAlias x a -- | name of the alias [rtName] :: RTAlias x a -> Symbol -- | type parameters [rtTArgs] :: RTAlias x a -> [x] -- | value parameters [rtVArgs] :: RTAlias x a -> [Symbol] -- | what the alias expands to , rtMod :: !ModName -- ^ module where alias -- was defined [rtBody] :: RTAlias x a -> a type OkRT c tv r = (TyConable c, PPrint tv, PPrint c, PPrint r, Reftable r, Reftable (RTProp c tv ()), Reftable (RTProp c tv r), Eq c, Eq tv, Hashable tv) lmapEAlias :: LMap -> Located (RTAlias Symbol Expr) dropImplicits :: RType c tv r -> RType c tv r data HSeg t HBind :: !Symbol -> t -> HSeg t [hs_addr] :: HSeg t -> !Symbol [hs_val] :: HSeg t -> t HVar :: UsedPVar -> HSeg t -- | A World is a Separation Logic predicate that is essentially a -- sequence of binders that satisfies two invariants (TODO:LIQUID): 1. -- Each `hs_addr :: Symbol` appears at most once, 2. There is at most one -- HVar in a list. newtype World t World :: [HSeg t] -> World t class (Eq c) => TyConable c isFun :: TyConable c => c -> Bool isList :: TyConable c => c -> Bool isTuple :: TyConable c => c -> Bool ppTycon :: TyConable c => c -> Doc isClass :: TyConable c => c -> Bool isEqual :: TyConable c => c -> Bool isNumCls :: TyConable c => c -> Bool isFracCls :: TyConable c => c -> Bool class SubsTy tv ty a subt :: SubsTy tv ty a => (tv, ty) -> a -> a data RTVar tv s RTVar :: tv -> RTVInfo s -> RTVar tv s [ty_var_value] :: RTVar tv s -> tv [ty_var_info] :: RTVar tv s -> RTVInfo s data RTVInfo s RTVNoInfo :: Bool -> RTVInfo s [rtv_is_pol] :: RTVInfo s -> Bool RTVInfo :: Symbol -> s -> Bool -> Bool -> RTVInfo s [rtv_name] :: RTVInfo s -> Symbol [rtv_kind] :: RTVInfo s -> s [rtv_is_val] :: RTVInfo s -> Bool [rtv_is_pol] :: RTVInfo s -> Bool makeRTVar :: tv -> RTVar tv s mapTyVarValue :: (tv1 -> tv2) -> RTVar tv1 s -> RTVar tv2 s dropTyVarInfo :: RTVar tv s1 -> RTVar tv s2 rTVarToBind :: RTVar RTyVar s -> Maybe (Symbol, s) setRtvPol :: RTVar tv a -> Bool -> RTVar tv a -- | Abstract Predicate Variables ---------------------------------- data PVar t PV :: !Symbol -> !PVKind t -> !Symbol -> ![(t, Symbol, Expr)] -> PVar t [pname] :: PVar t -> !Symbol [ptype] :: PVar t -> !PVKind t [parg] :: PVar t -> !Symbol [pargs] :: PVar t -> ![(t, Symbol, Expr)] isPropPV :: PVar t -> Bool pvType :: PVar t -> t data PVKind t PVProp :: t -> PVKind t PVHProp :: PVKind t newtype Predicate Pr :: [UsedPVar] -> Predicate data UReft r MkUReft :: !r -> !Predicate -> UReft r [ur_reft] :: UReft r -> !r [ur_pred] :: UReft r -> !Predicate -- | Termination expressions data SizeFun -- | x -> F.EVar x IdSizeFun :: SizeFun -- | x -> f x SymSizeFun :: LocSymbol -> SizeFun szFun :: SizeFun -> Symbol -> Expr -- | Data type refinements data DataDecl DataDecl :: DataName -> [Symbol] -> [PVar BSort] -> [DataCtor] -> !SourcePos -> Maybe SizeFun -> Maybe BareType -> !DataDeclKind -> DataDecl -- | Type Constructor Name [tycName] :: DataDecl -> DataName -- | Tyvar Parameters [tycTyVars] :: DataDecl -> [Symbol] -- | PVar Parameters [tycPVars] :: DataDecl -> [PVar BSort] -- | Data Constructors [tycDCons] :: DataDecl -> [DataCtor] -- | Source Position [tycSrcPos] :: DataDecl -> !SourcePos -- | Default termination measure [tycSFun] :: DataDecl -> Maybe SizeFun -- | Type of Ind-Prop [tycPropTy] :: DataDecl -> Maybe BareType -- | User-defined or Auto-lifted [tycKind] :: DataDecl -> !DataDeclKind -- | The name of the TyCon corresponding to a DataDecl data DataName -- | for isVanillyAlgTyCon we can directly use the TyCon -- name DnName :: !LocSymbol -> DataName -- | for FamInst TyCon we save some DataCon name DnCon :: !LocSymbol -> DataName dataNameSymbol :: DataName -> LocSymbol -- | Data Constructor data DataCtor DataCtor :: LocSymbol -> [Symbol] -> [BareType] -> [(Symbol, BareType)] -> Maybe BareType -> DataCtor -- | DataCon name [dcName] :: DataCtor -> LocSymbol -- | Type parameters [dcTyVars] :: DataCtor -> [Symbol] -- | The GHC ThetaType corresponding to DataCon.dataConSig [dcTheta] :: DataCtor -> [BareType] -- | field-name and field-Type pairs [dcFields] :: DataCtor -> [(Symbol, BareType)] -- | Possible output (if in GADT form) [dcResult] :: DataCtor -> Maybe BareType data DataConP DataConP :: !SourcePos -> !DataCon -> ![RTyVar] -> ![PVar RSort] -> ![SpecType] -> ![(Symbol, SpecType)] -> !SpecType -> !Bool -> !Symbol -> !SourcePos -> DataConP [dcpLoc] :: DataConP -> !SourcePos -- | Corresponding GHC DataCon [dcpCon] :: DataConP -> !DataCon -- | Type parameters [dcpFreeTyVars] :: DataConP -> ![RTyVar] -- | Abstract Refinement parameters [dcpFreePred] :: DataConP -> ![PVar RSort] -- | ? Class constraints (via dataConStupidTheta) [dcpTyConstrs] :: DataConP -> ![SpecType] -- | Value parameters [dcpTyArgs] :: DataConP -> ![(Symbol, SpecType)] -- | Result type , tyData :: !SpecType -- ^ The generic ADT, see -- [NOTE:DataCon-Data] [dcpTyRes] :: DataConP -> !SpecType -- | Was this specified in GADT style (if so, DONT use function names as -- fields) [dcpIsGadt] :: DataConP -> !Bool -- | Which module was this defined in [dcpModule] :: DataConP -> !Symbol [dcpLocE] :: DataConP -> !SourcePos data HasDataDecl NoDecl :: Maybe SizeFun -> HasDataDecl HasDecl :: HasDataDecl hasDecl :: DataDecl -> HasDataDecl -- | What kind of DataDecl is it? data DataDeclKind -- | User defined data-definitions (should have refined fields) DataUser :: DataDeclKind -- | Automatically lifted data-definitions (do not have refined fields) DataReflected :: DataDeclKind data TyConP TyConP :: !SourcePos -> !TyCon -> ![RTyVar] -> ![PVar RSort] -> !VarianceInfo -> !VarianceInfo -> !Maybe SizeFun -> TyConP [tcpLoc] :: TyConP -> !SourcePos [tcpCon] :: TyConP -> !TyCon [tcpFreeTyVarsTy] :: TyConP -> ![RTyVar] [tcpFreePredTy] :: TyConP -> ![PVar RSort] [tcpVarianceTs] :: TyConP -> !VarianceInfo [tcpVariancePs] :: TyConP -> !VarianceInfo [tcpSizeFun] :: TyConP -> !Maybe SizeFun type RRType = RType RTyCon RTyVar " "Resolved" version" type RRProp r = Ref RSort (RRType r) type BRType = RType BTyCon BTyVar " "Bare" parsed version" type BRProp r = Ref BSort (BRType r) type BSort = BRType () type BPVar = PVar BSort -- | Unified Representation of Refinement Types -- -------------------------------- type RTVU c tv = RTVar tv (RType c tv ()) type PVU c tv = PVar (RType c tv ()) type BareType = BRType RReft type PrType = RRType Predicate type SpecType = RRType RReft type SpecProp = RRProp RReft type SpecRTVar = RTVar RTyVar RSort type SpecRep = RRep RReft type LocBareType = Located BareType type LocSpecType = Located SpecType type RSort = RRType () -- | Predicates -- ---------------------------------------------------------------- type UsedPVar = PVar () type RPVar = PVar RSort type RReft = UReft Reft -- | The type used during constraint generation, used also to define -- contexts for errors, hence in this file, and NOT in elsewhere. **DO -- NOT ATTEMPT TO MOVE** Am splitting into + global : many bindings, -- shared across all constraints + local : few bindings, relevant to -- particular constraints type REnv = AREnv SpecType data AREnv t REnv :: HashMap Symbol t -> HashMap Symbol t -> AREnv t -- | the "global" names for module [reGlobal] :: AREnv t -> HashMap Symbol t -- | the "local" names for sub-exprs [reLocal] :: AREnv t -> HashMap Symbol t -- | Constructor and Destructors for RTypes -- ------------------------------------ data RTypeRep c tv r RTypeRep :: [(RTVar tv (RType c tv ()), r)] -> [PVar (RType c tv ())] -> [Symbol] -> [r] -> [RType c tv r] -> [Symbol] -> [r] -> [RType c tv r] -> RType c tv r -> RTypeRep c tv r [ty_vars] :: RTypeRep c tv r -> [(RTVar tv (RType c tv ()), r)] [ty_preds] :: RTypeRep c tv r -> [PVar (RType c tv ())] [ty_ebinds] :: RTypeRep c tv r -> [Symbol] [ty_erefts] :: RTypeRep c tv r -> [r] [ty_eargs] :: RTypeRep c tv r -> [RType c tv r] [ty_binds] :: RTypeRep c tv r -> [Symbol] [ty_refts] :: RTypeRep c tv r -> [r] [ty_args] :: RTypeRep c tv r -> [RType c tv r] [ty_res] :: RTypeRep c tv r -> RType c tv r fromRTypeRep :: RTypeRep c tv r -> RType c tv r toRTypeRep :: RType c tv r -> RTypeRep c tv r mkArrow :: [(RTVar tv (RType c tv ()), r)] -> [PVar (RType c tv ())] -> [(Symbol, RType c tv r, r)] -> [(Symbol, RType c tv r, r)] -> RType c tv r -> RType c tv r bkArrowDeep :: RType t t1 a -> ([Symbol], [RType t t1 a], [a], RType t t1 a) bkArrow :: RType t t1 a -> (([Symbol], [RType t t1 a], [a]), ([Symbol], [RType t t1 a], [a]), RType t t1 a) safeBkArrow :: PPrint (RType t t1 a) => RType t t1 a -> (([Symbol], [RType t t1 a], [a]), ([Symbol], [RType t t1 a], [a]), RType t t1 a) mkUnivs :: (Foldable t, Foldable t1) => t (RTVar tv (RType c tv ()), r) -> t1 (PVar (RType c tv ())) -> RType c tv r -> RType c tv r bkUniv :: RType tv c r -> ([(RTVar c (RType tv c ()), r)], [PVar (RType tv c ())], RType tv c r) bkClass :: (PPrint c, TyConable c) => RType c tv r -> ([(c, [RType c tv r])], RType c tv r) bkUnivClass :: SpecType -> ([(SpecRTVar, RReft)], [PVar RSort], [(RTyCon, [SpecType])], SpecType) rImpF :: Monoid r => Symbol -> RType c tv r -> RType c tv r -> RType c tv r rFun :: Monoid r => Symbol -> RType c tv r -> RType c tv r -> RType c tv r rCls :: Monoid r => TyCon -> [RType RTyCon tv r] -> RType RTyCon tv r rRCls :: Monoid r => c -> [RType c tv r] -> RType c tv r pvars :: Predicate -> [UsedPVar] pappSym :: Show a => a -> Symbol pApp :: Symbol -> [Expr] -> Expr isBase :: RType t t1 t2 -> Bool isFunTy :: RType t t1 t2 -> Bool isTrivial :: (Reftable r, TyConable c) => RType c tv r -> Bool hasHole :: Reftable r => r -> Bool efoldReft :: (Reftable r, TyConable c) => (Symbol -> RType c tv r -> Bool) -> BScope -> (c -> [RType c tv r] -> [(Symbol, a)]) -> (RTVar tv (RType c tv ()) -> [(Symbol, a)]) -> (RType c tv r -> a) -> (SEnv a -> Maybe (RType c tv r) -> r -> b -> b) -> (PVar (RType c tv ()) -> SEnv a -> SEnv a) -> SEnv a -> b -> RType c tv r -> b foldReft :: (Reftable r, TyConable c) => BScope -> (SEnv (RType c tv r) -> r -> a -> a) -> a -> RType c tv r -> a foldReft' :: (Reftable r, TyConable c) => (Symbol -> RType c tv r -> Bool) -> BScope -> (RType c tv r -> b) -> (SEnv b -> Maybe (RType c tv r) -> r -> a -> a) -> a -> RType c tv r -> a emapReft :: ([Symbol] -> r1 -> r2) -> [Symbol] -> RType c tv r1 -> RType c tv r2 mapReft :: (r1 -> r2) -> RType c tv r1 -> RType c tv r2 mapReftM :: Monad m => (r1 -> m r2) -> RType c tv r1 -> m (RType c tv r2) mapPropM :: Monad m => (RTProp c tv r -> m (RTProp c tv r)) -> RType c tv r -> m (RType c tv r) -- | Visitors -- ------------------------------------------------------------------ mapExprReft :: (Symbol -> Expr -> Expr) -> RType c tv RReft -> RType c tv RReft mapBot :: (RType c tv r -> RType c tv r) -> RType c tv r -> RType c tv r mapBind :: (Symbol -> Symbol) -> RType c tv r -> RType c tv r foldRType :: (acc -> RType c tv r -> acc) -> acc -> RType c tv r -> acc -- | Different kinds of Check Obligations -- ------------------------------------ data Oblig -- | Obligation that proves termination OTerm :: Oblig -- | Obligation that proves invariants OInv :: Oblig -- | Obligation that proves subtyping constraints OCons :: Oblig ignoreOblig :: RType t t1 t2 -> RType t t1 t2 addInvCond :: SpecType -> RReft -> SpecType -- | Annotations ------------------------------------------------------- newtype AnnInfo a AI :: HashMap SrcSpan [(Maybe Text, a)] -> AnnInfo a data Annot t AnnUse :: t -> Annot t AnnDef :: t -> Annot t AnnRDf :: t -> Annot t AnnLoc :: SrcSpan -> Annot t -- | Var Hole Info ----------------------------------------------------- data HoleInfo i t HoleInfo :: t -> SrcSpan -> AREnv t -> i -> HoleInfo i t [htype] :: HoleInfo i t -> t [hloc] :: HoleInfo i t -> SrcSpan [henv] :: HoleInfo i t -> AREnv t [info] :: HoleInfo i t -> i -- | Output -- -------------------------------------------------------------------- data Output a O :: Maybe [String] -> !AnnInfo a -> !AnnInfo a -> ![SrcSpan] -> ErrorResult -> Output a [o_vars] :: Output a -> Maybe [String] [o_types] :: Output a -> !AnnInfo a [o_templs] :: Output a -> !AnnInfo a [o_bots] :: Output a -> ![SrcSpan] [o_result] :: Output a -> ErrorResult hole :: Expr isHole :: Expr -> Bool hasHoleTy :: RType t t1 t2 -> Bool ofRSort :: Reftable r => RType c tv () -> RType c tv r toRSort :: RType c tv r -> RType c tv () rTypeValueVar :: Reftable r => RType c tv r -> Symbol rTypeReft :: Reftable r => RType c tv r -> Reft stripRTypeBase :: RType c tv r -> Maybe r topRTypeBase :: Reftable r => RType c tv r -> RType c tv r class PPrint a pprintTidy :: PPrint a => Tidy -> a -> Doc pprintPrec :: PPrint a => Int -> Tidy -> a -> Doc pprint :: PPrint a => a -> Doc showpp :: PPrint a => a -> String -- | Printer -- ---------------------------------------------------------------- data PPEnv PP :: Bool -> Bool -> Bool -> Bool -> PPEnv -- | print abstract-predicates [ppPs] :: PPEnv -> Bool -- | print the unique suffix for each tyvar [ppTyVar] :: PPEnv -> Bool -- | print the tycons without qualification [ppShort] :: PPEnv -> Bool -- | gross with full info [ppDebug] :: PPEnv -> Bool ppEnv :: PPEnv ppEnvShort :: PPEnv -> PPEnv -- | Module Names -- -------------------------------------------------------------- data ModName ModName :: !ModType -> !ModuleName -> ModName data ModType Target :: ModType SrcImport :: ModType SpecImport :: ModType isSrcImport :: ModName -> Bool isSpecImport :: ModName -> Bool isTarget :: ModName -> Bool getModName :: ModName -> ModuleName getModString :: ModName -> String qualifyModName :: ModName -> Symbol -> Symbol -- | Refinement Type Aliases -- --------------------------------------------------- data RTEnv tv t RTE :: HashMap Symbol (Located (RTAlias tv t)) -> HashMap Symbol (Located (RTAlias Symbol Expr)) -> RTEnv tv t [typeAliases] :: RTEnv tv t -> HashMap Symbol (Located (RTAlias tv t)) [exprAliases] :: RTEnv tv t -> HashMap Symbol (Located (RTAlias Symbol Expr)) type BareRTEnv = RTEnv Symbol BareType type SpecRTEnv = RTEnv RTyVar SpecType type BareRTAlias = RTAlias Symbol BareType type SpecRTAlias = RTAlias RTyVar SpecType type Error = TError SpecType -- | Error Data Type -- ----------------------------------------------------------- type ErrorResult = FixResult UserError -- | Diagnostic info -- ----------------------------------------------------------- data Warning mkWarning :: SrcSpan -> Doc -> Warning data Diagnostics mkDiagnostics :: [Warning] -> [Error] -> Diagnostics emptyDiagnostics :: Diagnostics noErrors :: Diagnostics -> Bool allWarnings :: Diagnostics -> [Warning] allErrors :: Diagnostics -> [Error] -- | Printing Warnings -- --------------------------------------------------------- printWarning :: DynFlags -> Warning -> IO () -- | Source Information Associated With Constraints -- ---------------------------- data Cinfo Ci :: !SrcSpan -> !Maybe Error -> !Maybe Var -> Cinfo [ci_loc] :: Cinfo -> !SrcSpan [ci_err] :: Cinfo -> !Maybe Error [ci_var] :: Cinfo -> !Maybe Var data Measure ty ctor M :: LocSymbol -> ty -> [Def ty ctor] -> !MeasureKind -> !UnSortedExprs -> Measure ty ctor [msName] :: Measure ty ctor -> LocSymbol [msSort] :: Measure ty ctor -> ty [msEqns] :: Measure ty ctor -> [Def ty ctor] [msKind] :: Measure ty ctor -> !MeasureKind [msUnSorted] :: Measure ty ctor -> !UnSortedExprs type UnSortedExprs = [UnSortedExpr] type UnSortedExpr = ([Symbol], Expr) data MeasureKind -- | due to `reflect foo` MsReflect :: MeasureKind -- | due to `measure foo` with old-style (non-haskell) equations MsMeasure :: MeasureKind -- | due to `measure foo` with new-style haskell equations MsLifted :: MeasureKind -- | due to `class measure` definition MsClass :: MeasureKind -- | due to `measure foo` without equations c.f. testsposT1223.hs MsAbsMeasure :: MeasureKind -- | due to selector-fields e.g. `data Foo = Foo { fld :: Int }` MsSelector :: MeasureKind -- | due to checkers e.g. `is-F` for `data Foo = F ... | G ...` MsChecker :: MeasureKind data CMeasure ty CM :: LocSymbol -> ty -> CMeasure ty [cName] :: CMeasure ty -> LocSymbol [cSort] :: CMeasure ty -> ty data Def ty ctor Def :: LocSymbol -> ctor -> Maybe ty -> [(Symbol, Maybe ty)] -> Body -> Def ty ctor [measure] :: Def ty ctor -> LocSymbol [ctor] :: Def ty ctor -> ctor [dsort] :: Def ty ctor -> Maybe ty [binds] :: Def ty ctor -> [(Symbol, Maybe ty)] [body] :: Def ty ctor -> Body -- | Measures data Body -- | Measure Refinement: {v | v = e } E :: Expr -> Body -- | Measure Refinement: {v | (? v) = p } P :: Expr -> Body -- | Measure Refinement: {v | p} R :: Symbol -> Expr -> Body data MSpec ty ctor MSpec :: HashMap Symbol [Def ty ctor] -> HashMap LocSymbol (Measure ty ctor) -> HashMap LocSymbol (Measure ty ()) -> ![Measure ty ctor] -> MSpec ty ctor [ctorMap] :: MSpec ty ctor -> HashMap Symbol [Def ty ctor] [measMap] :: MSpec ty ctor -> HashMap LocSymbol (Measure ty ctor) [cmeasMap] :: MSpec ty ctor -> HashMap LocSymbol (Measure ty ()) [imeas] :: MSpec ty ctor -> ![Measure ty ctor] -- | Information about scope Binders Scope in type BScope = Bool data RClass ty RClass :: BTyCon -> [ty] -> [BTyVar] -> [(LocSymbol, ty)] -> RClass ty [rcName] :: RClass ty -> BTyCon [rcSupers] :: RClass ty -> [ty] [rcTyVars] :: RClass ty -> [BTyVar] [rcMethods] :: RClass ty -> [(LocSymbol, ty)] -- | KVar Profile -- -------------------------------------------------------------- data KVKind -- | Recursive binder letrec x = ... RecBindE :: Var -> KVKind -- | Non recursive binder let x = ... NonRecBindE :: Var -> KVKind TypeInstE :: KVKind PredInstE :: KVKind LamE :: KVKind -- | Int is the number of cases CaseE :: Int -> KVKind LetE :: KVKind ImplictE :: KVKind -- | Projecting out field of ProjectE :: KVKind data KVProf emptyKVProf :: KVProf updKVProf :: KVKind -> Kuts -> KVProf -> KVProf mapRTAVars :: (a -> b) -> RTAlias a ty -> RTAlias b ty insertsSEnv :: SEnv a -> [(Symbol, a)] -> SEnv a data LogicMap LM :: HashMap Symbol LMap -> HashMap Var (Maybe Symbol) -> LogicMap -- | Map from symbols to equations they define [lmSymDefs] :: LogicMap -> HashMap Symbol LMap -- | Map from (lifted) Vars to Symbol; see: NOTE:LIFTED-VAR-SYMBOLS -- and NOTE:REFLECT-IMPORTs [lmVarSyms] :: LogicMap -> HashMap Var (Maybe Symbol) toLogicMap :: [(LocSymbol, [Symbol], Expr)] -> LogicMap eAppWithMap :: LogicMap -> Located Symbol -> [Expr] -> Expr -> Expr data LMap LMap :: LocSymbol -> [Symbol] -> Expr -> LMap [lmVar] :: LMap -> LocSymbol [lmArgs] :: LMap -> [Symbol] [lmExpr] :: LMap -> Expr type RDEnv = DEnv Var SpecType newtype DEnv x ty DEnv :: HashMap x (HashMap Symbol (RISig ty)) -> DEnv x ty -- | Refined Instances -- --------------------------------------------------------- data RInstance t RI :: BTyCon -> [t] -> [(LocSymbol, RISig t)] -> RInstance t [riclass] :: RInstance t -> BTyCon [ritype] :: RInstance t -> [t] [risigs] :: RInstance t -> [(LocSymbol, RISig t)] data RISig t RIAssumed :: t -> RISig t RISig :: t -> RISig t data RILaws ty RIL :: BTyCon -> [ty] -> [ty] -> [(LocSymbol, LocSymbol)] -> Located () -> RILaws ty [rilName] :: RILaws ty -> BTyCon [rilSupers] :: RILaws ty -> [ty] [rilTyArgs] :: RILaws ty -> [ty] [rilEqus] :: RILaws ty -> [(LocSymbol, LocSymbol)] [rilPos] :: RILaws ty -> Located () data MethodType t MT :: !Maybe t -> !Maybe t -> MethodType t [tyInstance] :: MethodType t -> !Maybe t [tyClass] :: MethodType t -> !Maybe t getMethodType :: MethodType t -> Maybe t class Reftable r => UReftable r ofUReft :: UReftable r => UReft Reft -> r liquidBegin :: String liquidEnd :: String -- | Values Related to Specifications ------------------------------------ data Axiom b s e Axiom :: (Var, Maybe DataCon) -> Maybe b -> [b] -> [s] -> e -> e -> Axiom b s e [aname] :: Axiom b s e -> (Var, Maybe DataCon) [rname] :: Axiom b s e -> Maybe b [abinds] :: Axiom b s e -> [b] [atypes] :: Axiom b s e -> [s] [alhs] :: Axiom b s e -> e [arhs] :: Axiom b s e -> e type HAxiom = Axiom Var Type CoreExpr rtyVarType :: RTyVar -> Type tyVarVar :: RTVar RTyVar c -> Var instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.PPEnv instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.LogicMap instance GHC.Show.Show t => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.PVKind t) instance Data.Traversable.Traversable Language.Haskell.Liquid.Types.Types.PVKind instance Data.Foldable.Foldable Language.Haskell.Liquid.Types.Types.PVKind instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.PVKind instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.PVKind t) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.PVKind t) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.PVar instance GHC.Show.Show t => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.PVar t) instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.PVar t) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.PVar t) instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.Predicate instance Data.Data.Data Language.Haskell.Liquid.Types.Types.Predicate instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.Predicate instance Data.Data.Data Language.Haskell.Liquid.Types.Types.BTyVar instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.BTyVar instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.BTyVar instance Data.Data.Data Language.Haskell.Liquid.Types.Types.RTyVar instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.RTyVar instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.BTyCon instance Data.Data.Data Language.Haskell.Liquid.Types.Types.BTyCon instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.BTyCon instance Data.Hashable.Class.Hashable s => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RTVInfo s) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.RTVInfo instance Data.Data.Data s => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RTVInfo s) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RTVInfo s) instance (Data.Hashable.Class.Hashable tv, Data.Hashable.Class.Hashable s) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RTVar tv s) instance (Data.Data.Data tv, Data.Data.Data s) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RTVar tv s) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RTVar tv s) instance (Data.Hashable.Class.Hashable τ, Data.Hashable.Class.Hashable t) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.Ref τ t) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.Ref τ) instance (Data.Data.Data τ, Data.Data.Data t) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.Ref τ t) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.Ref τ t) instance (GHC.Classes.Eq τ, GHC.Classes.Eq t) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.Ref τ t) instance (Data.Hashable.Class.Hashable tv, Data.Hashable.Class.Hashable r, Data.Hashable.Class.Hashable c) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RType c tv r) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.RType c tv) instance (Data.Data.Data c, Data.Data.Data tv, Data.Data.Data r) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RType c tv r) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RType c tv r) instance (GHC.Classes.Eq tv, GHC.Classes.Eq r, GHC.Classes.Eq c) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RType c tv r) instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.HSeg t) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.HSeg t) instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.World t) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.World t) instance Data.Hashable.Class.Hashable r => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.UReft r) instance Data.Traversable.Traversable Language.Haskell.Liquid.Types.Types.UReft instance Data.Foldable.Foldable Language.Haskell.Liquid.Types.Types.UReft instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.UReft instance Data.Data.Data r => Data.Data.Data (Language.Haskell.Liquid.Types.Types.UReft r) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.UReft r) instance GHC.Classes.Eq r => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.UReft r) instance Data.Hashable.Class.Hashable ty => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RILaws ty) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RILaws ty) instance Data.Data.Data ty => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RILaws ty) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.RILaws instance GHC.Show.Show ty => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RILaws ty) instance GHC.Classes.Eq ty => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RILaws ty) instance Data.Hashable.Class.Hashable t => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RISig t) instance GHC.Show.Show t => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RISig t) instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RISig t) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.RISig instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RISig t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RISig t) instance Data.Hashable.Class.Hashable t => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RInstance t) instance GHC.Show.Show t => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RInstance t) instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RInstance t) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.RInstance instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RInstance t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RInstance t) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.DEnv x) instance (GHC.Show.Show x, GHC.Show.Show ty) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.DEnv x ty) instance (GHC.Classes.Eq x, Data.Hashable.Class.Hashable x) => GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.DEnv x ty) instance (GHC.Classes.Eq x, Data.Hashable.Class.Hashable x) => GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.DEnv x ty) instance GHC.Show.Show t => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.MethodType t) instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.DataName instance Data.Data.Data Language.Haskell.Liquid.Types.Types.DataName instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.DataName instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.DataName instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.DataCtor instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.DataCtor instance Data.Data.Data Language.Haskell.Liquid.Types.Types.DataCtor instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.SizeFun instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.SizeFun instance Data.Data.Data Language.Haskell.Liquid.Types.Types.SizeFun instance Data.Data.Data Language.Haskell.Liquid.Types.Types.TyConInfo instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.TyConInfo instance Data.Data.Data Language.Haskell.Liquid.Types.Types.RTyCon instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.RTyCon instance Data.Data.Data Language.Haskell.Liquid.Types.Types.DataConP instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.DataConP instance Data.Data.Data Language.Haskell.Liquid.Types.Types.TyConP instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.TyConP instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.DataDeclKind instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.DataDeclKind instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.DataDeclKind instance Data.Data.Data Language.Haskell.Liquid.Types.Types.DataDeclKind instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.DataDeclKind instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.DataDecl instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.DataDecl instance Data.Data.Data Language.Haskell.Liquid.Types.Types.DataDecl instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.HasDataDecl instance (Data.Hashable.Class.Hashable x, Data.Hashable.Class.Hashable a) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RTAlias x a) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.RTAlias x) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RTAlias x a) instance (Data.Data.Data x, Data.Data.Data a) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RTAlias x a) instance (GHC.Classes.Eq x, GHC.Classes.Eq a) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RTAlias x a) instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.Warning instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.Warning instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.Diagnostics instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.Cinfo instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.Cinfo instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.Cinfo instance Data.Data.Data Language.Haskell.Liquid.Types.Types.ModType instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.ModType instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.ModType instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.ModType instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.ModType instance Data.Data.Data Language.Haskell.Liquid.Types.Types.ModName instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.ModName instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.ModName instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.ModName instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.ModName instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.Body instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.Body instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.Body instance Data.Data.Data Language.Haskell.Liquid.Types.Types.Body instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.Body instance (Data.Hashable.Class.Hashable ctor, Data.Hashable.Class.Hashable ty) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.Def ty) instance (GHC.Classes.Eq ctor, GHC.Classes.Eq ty) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance (Data.Data.Data ty, Data.Data.Data ctor) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance (GHC.Show.Show ctor, GHC.Show.Show ty) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.MeasureKind instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.MeasureKind instance Data.Data.Data Language.Haskell.Liquid.Types.Types.MeasureKind instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.MeasureKind instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.MeasureKind instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.MeasureKind instance (Data.Hashable.Class.Hashable ty, Data.Hashable.Class.Hashable ctor) => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.Measure ty ctor) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.Measure ty) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.Measure ty ctor) instance (Data.Data.Data ty, Data.Data.Data ctor) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.Measure ty ctor) instance (GHC.Classes.Eq ty, GHC.Classes.Eq ctor) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.Measure ty ctor) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.CMeasure instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.CMeasure ty) instance Data.Data.Data ty => Data.Data.Data (Language.Haskell.Liquid.Types.Types.CMeasure ty) instance Data.Hashable.Class.Hashable ty => Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.RClass ty) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.RClass ty) instance Data.Data.Data ty => Data.Data.Data (Language.Haskell.Liquid.Types.Types.RClass ty) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.RClass instance GHC.Show.Show ty => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RClass ty) instance GHC.Classes.Eq ty => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RClass ty) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.AnnInfo instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance Data.Data.Data a => Data.Data.Data (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.Annot instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.Annot t) instance Data.Data.Data t => Data.Data.Data (Language.Haskell.Liquid.Types.Types.Annot t) instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.Output instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.Output a) instance Data.Data.Data Language.Haskell.Liquid.Types.Types.KVKind instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.KVKind instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.KVKind instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.KVKind instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.KVKind instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.KVProf instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.MSpec ty) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Types.MSpec ty ctor) instance (Data.Data.Data ty, Data.Data.Data ctor) => Data.Data.Data (Language.Haskell.Liquid.Types.Types.MSpec ty ctor) instance Data.Bifunctor.Bifunctor Language.Haskell.Liquid.Types.Types.MSpec instance (Language.Fixpoint.Types.PrettyPrint.PPrint t, Language.Fixpoint.Types.PrettyPrint.PPrint a) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.MSpec t a) instance (GHC.Show.Show ty, GHC.Show.Show ctor, Language.Fixpoint.Types.PrettyPrint.PPrint ctor, Language.Fixpoint.Types.PrettyPrint.PPrint ty) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.MSpec ty ctor) instance GHC.Classes.Eq ctor => GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.MSpec ty ctor) instance GHC.Classes.Eq ctor => GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.MSpec ty ctor) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.KVProf instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.KVProf instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.KVKind instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.KVKind instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.KVKind instance GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.Output a) instance GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.Output a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.Annot a) instance GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance GHC.Base.Functor (Language.Haskell.Liquid.Types.Types.HoleInfo i) instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.HoleInfo i t) instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RClass t) instance Data.Binary.Class.Binary ty => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RClass ty) instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.CMeasure t) instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.CMeasure t) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.CMeasure t) instance Language.Fixpoint.Types.Spans.Loc (Language.Haskell.Liquid.Types.Types.Measure a b) instance Data.Bifunctor.Bifunctor Language.Haskell.Liquid.Types.Types.Measure instance (Data.Binary.Class.Binary t, Data.Binary.Class.Binary c) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.Measure t c) instance (Language.Fixpoint.Types.PrettyPrint.PPrint t, Language.Fixpoint.Types.PrettyPrint.PPrint a) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.Measure t a) instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.Measure t a) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.Measure t a) instance Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Types.Measure ty ctor) instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.MeasureKind instance Data.Bifunctor.Bifunctor Language.Haskell.Liquid.Types.Types.Def instance (Data.Binary.Class.Binary t, Data.Binary.Class.Binary c) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.Def t c) instance Language.Fixpoint.Types.PrettyPrint.PPrint a => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.Def t a) instance Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.Body instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.Body instance Language.Fixpoint.Types.Refinements.Subable Language.Haskell.Liquid.Types.Types.Body instance GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.RTEnv tv t) instance GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.RTEnv tv t) instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.ModName instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.ModName instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.ModName instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.ModType instance Language.Fixpoint.Types.PrettyPrint.Fixpoint Language.Haskell.Liquid.Types.Types.Cinfo instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.Cinfo instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.Cinfo instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.Cinfo instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Types.Diagnostics instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Types.Diagnostics instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Types.REnv instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Types.REnv instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.REnv instance GHC.Base.Functor Language.Haskell.Liquid.Types.Types.AREnv instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.AREnv t) instance Language.Haskell.Liquid.Types.Types.UReftable (Language.Haskell.Liquid.Types.Types.UReft Language.Fixpoint.Types.Refinements.Reft) instance Language.Haskell.Liquid.Types.Types.UReftable () instance (Data.Binary.Class.Binary x, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RTAlias x a) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.HasDataDecl instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.DataDecl instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.DataDecl instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.DataDecl instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.DataDecl instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.DataDecl instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.DataDecl instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.DataDeclKind instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.DataDeclKind instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.TyConP instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.DataConP instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.RTyCon instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.RTyCon instance Language.Haskell.Liquid.Types.Types.TyConable Language.Haskell.Liquid.Types.Types.RTyCon instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.RTyCon instance Language.Fixpoint.Types.PrettyPrint.Fixpoint Language.Haskell.Liquid.Types.Types.RTyCon instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.RTyCon instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.RTyCon instance Data.Default.Class.Default Language.Haskell.Liquid.Types.Types.TyConInfo instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.TyConInfo instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.TyConInfo instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.SizeFun instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.SizeFun instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.SizeFun instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.SizeFun instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.DataCtor instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.DataCtor instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.DataName instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.DataName instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.DataName instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.DataName instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.DataName instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.DataName instance GHC.Show.Show (Language.Haskell.Liquid.Types.Types.Axiom Var.Var TyCoRep.Type CoreSyn.CoreExpr) instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RInstance t) instance Data.Binary.Class.Binary t => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RInstance t) instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RISig t) instance Data.Binary.Class.Binary t => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RISig t) instance Data.Binary.Class.Binary t => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RILaws t) instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RILaws t) instance Language.Haskell.Liquid.Types.Types.TyConable TyCon.TyCon instance Language.Haskell.Liquid.Types.Types.TyConable Language.Haskell.Liquid.Types.Types.Symbol instance Language.Haskell.Liquid.Types.Types.TyConable Language.Fixpoint.Types.Names.LocSymbol instance Language.Haskell.Liquid.Types.Types.TyConable Language.Haskell.Liquid.Types.Types.BTyCon instance (Language.Fixpoint.Types.Refinements.Reftable r, Language.Haskell.Liquid.Types.Types.TyConable c) => Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Types.RTProp c tv r) instance (Language.Fixpoint.Types.Refinements.Subable r, Language.Fixpoint.Types.Refinements.Reftable r, Language.Haskell.Liquid.Types.Types.TyConable c) => Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Types.RType c tv r) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.UReft a) instance GHC.Base.Monoid a => GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.UReft a) instance Control.DeepSeq.NFData r => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.UReft r) instance Data.Binary.Class.Binary r => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.UReft r) instance (Language.Fixpoint.Types.PrettyPrint.PPrint r, Language.Fixpoint.Types.Refinements.Reftable r) => Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.UReft r) instance Language.Fixpoint.Types.Refinements.Expression (Language.Haskell.Liquid.Types.Types.UReft ()) instance Language.Fixpoint.Types.Refinements.Subable r => Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Types.UReft r) instance GHC.Show.Show tv => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RTVU c tv) instance (Data.Binary.Class.Binary c, Data.Binary.Class.Binary tv, Data.Binary.Class.Binary r) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RType c tv r) instance (Control.DeepSeq.NFData c, Control.DeepSeq.NFData tv, Control.DeepSeq.NFData r) => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.RType c tv r) instance (Language.Fixpoint.Types.PrettyPrint.PPrint r, Language.Fixpoint.Types.Refinements.Reftable r, Language.Fixpoint.Types.PrettyPrint.PPrint t, Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RType c tv r)) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.Ref t (Language.Haskell.Liquid.Types.Types.RType c tv r)) instance (Data.Binary.Class.Binary τ, Data.Binary.Class.Binary t) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.Ref τ t) instance (Control.DeepSeq.NFData τ, Control.DeepSeq.NFData t) => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.Ref τ t) instance GHC.Classes.Eq tv => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RTVar tv s) instance (Data.Binary.Class.Binary tv, Data.Binary.Class.Binary s) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RTVar tv s) instance (Control.DeepSeq.NFData tv, Control.DeepSeq.NFData s) => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.RTVar tv s) instance Language.Fixpoint.Types.PrettyPrint.PPrint v => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RTVar v s) instance Control.DeepSeq.NFData s => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.RTVInfo s) instance Data.Binary.Class.Binary s => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.RTVInfo s) instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.BTyCon instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.BTyCon instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.BTyCon instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.BTyCon instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.BTyCon instance Language.Fixpoint.Types.PrettyPrint.Fixpoint Language.Haskell.Liquid.Types.Types.BTyCon instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.BTyCon instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.BTyCon instance Language.Fixpoint.Types.Spans.Loc Language.Haskell.Liquid.Types.Types.BTyCon instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.RTyVar instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.RTyVar instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.RTyVar instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.BTyVar instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.BTyVar instance Data.String.IsString Language.Haskell.Liquid.Types.Types.BTyVar instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.BTyVar instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.BTyVar instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.BTyVar instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Liquid.Types.Types.BTyVar instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.BTyVar instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.Predicate instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.Predicate instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.Predicate instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Types.Predicate instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Types.Predicate instance Language.Fixpoint.Types.Refinements.Subable Language.Haskell.Liquid.Types.Types.Predicate instance Language.Fixpoint.Types.Refinements.Reftable Language.Haskell.Liquid.Types.Types.Predicate instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.Predicate instance Language.Fixpoint.Types.Refinements.Subable Language.Haskell.Liquid.Types.Types.UsedPVar instance GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.PVar t) instance GHC.Classes.Ord (Language.Haskell.Liquid.Types.Types.PVar t) instance Data.Binary.Class.Binary t => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.PVar t) instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.PVar t) instance Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Types.PVar a) instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.PVar a) instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Types.PVKind a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Types.PVKind a) instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Types.LogicMap instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Types.LogicMap instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.LMap instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Errors.TError a) instance Data.Hashable.Class.Hashable Module.ModuleName instance GHC.Show.Show Module.ModuleName instance Language.Fixpoint.Types.Names.Symbolic Module.ModuleName instance Language.Fixpoint.Types.Refinements.Subable t => Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Errors.WithModel t) instance Language.Fixpoint.Types.Names.Symbolic DataCon.DataCon instance Language.Fixpoint.Types.PrettyPrint.PPrint DataCon.DataCon instance GHC.Classes.Ord TyCon.TyCon instance GHC.Classes.Ord DataCon.DataCon instance Language.Fixpoint.Types.PrettyPrint.PPrint TyCoRep.TyThing instance GHC.Show.Show DataCon.DataCon -- | This module contains a single function that converts a RType -> Doc -- without using *any* simplifications. module Language.Haskell.Liquid.Types.PrettyPrint type OkRT c tv r = (TyConable c, PPrint tv, PPrint c, PPrint r, Reftable r, Reftable (RTProp c tv ()), Reftable (RTProp c tv r), Eq c, Eq tv, Hashable tv) rtypeDoc :: OkRT c tv r => Tidy -> RType c tv r -> Doc pprManyOrdered :: (PPrint a, Ord a) => Tidy -> String -> [a] -> [Doc] pprintLongList :: PPrint a => Tidy -> [a] -> Doc pprintSymbol :: Symbol -> Doc -- | Printing Warnings -- --------------------------------------------------------- printWarning :: DynFlags -> Warning -> IO () -- | Pretty-printing errors -- ---------------------------------------------------- printError :: (Show e, PPrint e) => Tidy -> DynFlags -> TError e -> IO () -- | Similar in spirit to reportErrors from the GHC API, but it uses -- our pretty-printer and shim functions under the hood. reportErrors :: (Show e, PPrint e) => Tidy -> [TError e] -> TcRn () instance Language.Fixpoint.Types.PrettyPrint.PPrint ErrUtils.ErrMsg instance Language.Fixpoint.Types.PrettyPrint.PPrint HscTypes.SourceError instance Language.Fixpoint.Types.PrettyPrint.PPrint Var.Var instance Language.Fixpoint.Types.PrettyPrint.PPrint (CoreSyn.Expr Var.Var) instance Language.Fixpoint.Types.PrettyPrint.PPrint (CoreSyn.Bind Var.Var) instance Language.Fixpoint.Types.PrettyPrint.PPrint Name.Name instance Language.Fixpoint.Types.PrettyPrint.PPrint TyCon.TyCon instance Language.Fixpoint.Types.PrettyPrint.PPrint TyCoRep.Type instance Language.Fixpoint.Types.PrettyPrint.PPrint Class.Class instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.Predicate instance Language.Fixpoint.Types.PrettyPrint.PPrint t => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.Annot t) instance Language.Fixpoint.Types.PrettyPrint.PPrint a => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance Language.Fixpoint.Types.PrettyPrint.PPrint a => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.LMap instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.LogicMap instance Language.Haskell.Liquid.Types.Types.OkRT c tv r => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RType c tv r) instance (Language.Fixpoint.Types.PrettyPrint.PPrint tv, Language.Fixpoint.Types.PrettyPrint.PPrint ty) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RTAlias tv ty) instance (Language.Fixpoint.Types.PrettyPrint.PPrint tv, Language.Fixpoint.Types.PrettyPrint.PPrint t) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RTEnv tv t) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Fixpoint.Types.PrettyPrint.Tidy instance (Language.Fixpoint.Types.PrettyPrint.PPrint r, Language.Fixpoint.Types.Refinements.Reftable r) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.UReft r) -- | This module contains the code for generating "tags" for constraints -- based on their source, i.e. the top-level binders under which the -- constraint was generated. These tags are used by fixpoint to -- prioritize constraints by the "source-level" function. module Language.Haskell.Liquid.UX.CTags -- | The TagKey is the top-level binder, and Tag is a -- singleton Int list type TagKey = Var type TagEnv = HashMap TagKey Tag defaultTag :: Tag makeTagEnv :: [CoreBind] -> TagEnv getTag :: TagKey -> TagEnv -> Tag memTagEnv :: TagKey -> TagEnv -> Bool -- | This module contains a wrappers and utility functions for accessing -- GHC module information. It should NEVER depend on module Language.Haskell.Liquid.GHC.TypeRep mkTyArg :: TyVar -> TyVarBinder showTy :: Type -> String instance (GHC.Classes.Eq tyvar, GHC.Classes.Eq argf) => GHC.Classes.Eq (Var.VarBndr tyvar argf) instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy TyCoRep.Type instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy TyCoRep.Coercion instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy CoAxiom.Role instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy (CoAxiom.CoAxiom CoAxiom.Branched) instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy TyCoRep.UnivCoProvenance instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy CoAxiom.CoAxiomRule instance (Language.Haskell.Liquid.GHC.TypeRep.SubstTy a, GHC.Base.Functor m) => Language.Haskell.Liquid.GHC.TypeRep.SubstTy (m a) instance GHC.Classes.Eq TyCoRep.Type instance GHC.Classes.Eq TyCoRep.Coercion module Language.Haskell.Liquid.GHC.SpanStack -- | A single span data Span -- | binder for whom we are generating constraint Var :: !Var -> Span -- | nearest known Source Span Tick :: !Tickish Var -> Span Span :: SrcSpan -> Span -- | Opaque type for a stack of spans data SpanStack empty :: SpanStack push :: Span -> SpanStack -> SpanStack srcSpan :: SpanStack -> SrcSpan showSpan :: Show a => a -> SrcSpan instance GHC.Show.Show Language.Haskell.Liquid.GHC.SpanStack.Span -- | This module contains functions for "resugaring" low-level GHC -- CoreExpr into high-level patterns, that can receive special -- case handling in different phases (e.g. ANF, Constraint Generation, -- etc.) module Language.Haskell.Liquid.GHC.Resugar -- | Data type for high-level patterns -- ----------------------------------------- data Pattern -- | e1 >>= x -> e2 PatBind :: !CoreExpr -> !Var -> !CoreExpr -> !Type -> !CoreExpr -> !Type -> !Type -> !Var -> Pattern [patE1] :: Pattern -> !CoreExpr -- | x [patX] :: Pattern -> !Var [patE2] :: Pattern -> !CoreExpr -- | m [patM] :: Pattern -> !Type -- | $dT [patDct] :: Pattern -> !CoreExpr [patTyA] :: Pattern -> !Type [patTyB] :: Pattern -> !Type [patFF] :: Pattern -> !Var PatReturn :: !CoreExpr -> !Type -> !CoreExpr -> !Type -> !Var -> Pattern -- | e [patE] :: Pattern -> !CoreExpr -- | m [patM] :: Pattern -> !Type -- | $dT [patDct] :: Pattern -> !CoreExpr -- | t [patTy] :: Pattern -> !Type -- | "return" [patRet] :: Pattern -> !Var PatProject :: !Var -> !Var -> !Type -> !DataCon -> ![Var] -> !Int -> Pattern -- | xe [patXE] :: Pattern -> !Var -- | x [patX] :: Pattern -> !Var -- | t [patTy] :: Pattern -> !Type -- | C [patCtor] :: Pattern -> !DataCon -- | [patBinds] :: Pattern -> ![Var] -- | i :: NatLT {len patBinds} [patIdx] :: Pattern -> !Int PatSelfBind :: !Var -> !CoreExpr -> Pattern -- | x [patX] :: Pattern -> !Var -- | e [patE] :: Pattern -> !CoreExpr PatSelfRecBind :: !Var -> !CoreExpr -> Pattern -- | x [patX] :: Pattern -> !Var -- | e [patE] :: Pattern -> !CoreExpr -- | Lift expressions into High-level patterns -- --------------------------------- lift :: CoreExpr -> Maybe Pattern -- | Lower patterns back into expressions -- -------------------------------------- lower :: Pattern -> CoreExpr instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.GHC.Resugar.Pattern module Language.Haskell.Liquid.GHC.Play isRecursivenewTyCon :: TyCon -> Bool isHoleVar :: Var -> Bool dataConImplicitIds :: DataCon -> [Id] class Subable a sub :: Subable a => HashMap CoreBndr CoreExpr -> a -> a subTy :: Subable a => HashMap TyVar Type -> a -> a subVar :: Expr t -> Id substTysWith :: HashMap Var Type -> Type -> Type substExpr :: HashMap Var Var -> CoreExpr -> CoreExpr mapType :: (Type -> Type) -> Type -> Type stringClassArg :: Type -> Maybe Type instance Language.Haskell.Liquid.GHC.Play.Subable CoreSyn.CoreExpr instance Language.Haskell.Liquid.GHC.Play.Subable TyCoRep.Coercion instance Language.Haskell.Liquid.GHC.Play.Subable (CoreSyn.Alt Var.Var) instance Language.Haskell.Liquid.GHC.Play.Subable Var.Var instance Language.Haskell.Liquid.GHC.Play.Subable (CoreSyn.Bind Var.Var) instance Language.Haskell.Liquid.GHC.Play.Subable TyCoRep.Type -- | Refinement Types. Mostly mirroring the GHC Type definition, but with -- room for refinements of various sorts. TODO: Desperately needs -- re-organization. module Language.Haskell.Liquid.Types.RefType -- | Information about Type Constructors data TyConMap uTop :: r -> UReft r uReft :: (Symbol, Expr) -> UReft Reft -- | Various functions for converting vanilla Reft to Spec uRType :: RType c tv a -> RType c tv (UReft a) uRType' :: RType c tv (UReft a) -> RType c tv a uRTypeGen :: Reftable b => RType c tv a -> RType c tv b uPVar :: PVar t -> UsedPVar applySolution :: Functor f => FixSolution -> f SpecType -> f SpecType isDecreasing :: HashSet TyCon -> [RTyVar] -> SpecType -> Bool makeDecrType :: Symbolic a => HashSet TyCon -> [(a, (Symbol, RType RTyCon t (UReft Reft)))] -> Either (Symbol, RType RTyCon t (UReft Reft)) String -- | Termination Predicates -- ---------------------------------------------------- makeNumEnv :: (Foldable t, TyConable c) => t (RType c b t1) -> [b] makeLexRefa :: [Located Expr] -> [Located Expr] -> UReft Reft pdVar :: PVar t -> Predicate findPVar :: [PVar (RType c tv ())] -> UsedPVar -> PVar (RType c tv ()) class FreeVar a v allTyVars :: Ord tv => RType c tv r -> [tv] freeTyVars :: Eq tv => RType c tv r -> [RTVar tv (RType c tv ())] tyClasses :: OkRT RTyCon tv r => RType RTyCon tv r -> [(Class, [RType RTyCon tv r])] tyConName :: TyCon -> Symbol quantifyRTy :: (Monoid r, Eq tv) => [RTVar tv (RType c tv ())] -> RType c tv r -> RType c tv r quantifyFreeRTy :: (Monoid r, Eq tv) => RType c tv r -> RType c tv r ofType :: Monoid r => Type -> RRType r toType :: ToTypeable r => RRType r -> Type bareOfType :: Monoid r => Type -> BRType r bTyVar :: Symbol -> BTyVar rTyVar :: TyVar -> RTyVar -- | Helper Functions (RJ: Helping to do what?) -- -------------------------------- rVar :: Monoid r => TyVar -> RType c RTyVar r rApp :: TyCon -> [RType RTyCon tv r] -> [RTProp RTyCon tv r] -> r -> RType RTyCon tv r gApp :: TyCon -> [RTyVar] -> [PVar a] -> SpecType rEx :: Foldable t => t (Symbol, RType c tv r) -> RType c tv r -> RType c tv r symbolRTyVar :: Symbol -> RTyVar bareRTyVar :: BTyVar -> RTyVar tyConBTyCon :: TyCon -> BTyCon pdVarReft :: PVar t -> UReft Reft -- | Type Substitutions -- -------------------------------------------------------- subts :: SubsTy tv ty c => [(tv, ty)] -> c -> c subvPredicate :: (UsedPVar -> UsedPVar) -> Predicate -> Predicate subvUReft :: (UsedPVar -> UsedPVar) -> UReft Reft -> UReft Reft subsTyVar_meet :: (Eq tv, Hashable tv, Reftable r, TyConable c, SubsTy tv (RType c tv ()) c, SubsTy tv (RType c tv ()) r, SubsTy tv (RType c tv ()) (RType c tv ()), FreeVar c tv, SubsTy tv (RType c tv ()) tv, SubsTy tv (RType c tv ()) (RTVar tv (RType c tv ()))) => (tv, RType c tv (), RType c tv r) -> RType c tv r -> RType c tv r subsTyVar_meet' :: (Eq tv, Hashable tv, Reftable r, TyConable c, SubsTy tv (RType c tv ()) c, SubsTy tv (RType c tv ()) r, SubsTy tv (RType c tv ()) (RType c tv ()), FreeVar c tv, SubsTy tv (RType c tv ()) tv, SubsTy tv (RType c tv ()) (RTVar tv (RType c tv ()))) => (tv, RType c tv r) -> RType c tv r -> RType c tv r subsTyVar_nomeet :: (Eq tv, Hashable tv, Reftable r, TyConable c, SubsTy tv (RType c tv ()) c, SubsTy tv (RType c tv ()) r, SubsTy tv (RType c tv ()) (RType c tv ()), FreeVar c tv, SubsTy tv (RType c tv ()) tv, SubsTy tv (RType c tv ()) (RTVar tv (RType c tv ()))) => (tv, RType c tv (), RType c tv r) -> RType c tv r -> RType c tv r subsTyVars_nomeet :: (Eq tv, Foldable t, Hashable tv, Reftable r, TyConable c, SubsTy tv (RType c tv ()) c, SubsTy tv (RType c tv ()) r, SubsTy tv (RType c tv ()) (RType c tv ()), FreeVar c tv, SubsTy tv (RType c tv ()) tv, SubsTy tv (RType c tv ()) (RTVar tv (RType c tv ()))) => t (tv, RType c tv (), RType c tv r) -> RType c tv r -> RType c tv r subsTyVars_meet :: (Eq tv, Foldable t, Hashable tv, Reftable r, TyConable c, SubsTy tv (RType c tv ()) c, SubsTy tv (RType c tv ()) r, SubsTy tv (RType c tv ()) (RType c tv ()), FreeVar c tv, SubsTy tv (RType c tv ()) tv, SubsTy tv (RType c tv ()) (RTVar tv (RType c tv ()))) => t (tv, RType c tv (), RType c tv r) -> RType c tv r -> RType c tv r addTyConInfo :: (PPrint r, Reftable r, SubsTy RTyVar (RType RTyCon RTyVar ()) r, Reftable (RTProp RTyCon RTyVar r)) => TCEmb TyCon -> TyConMap -> RRType r -> RRType r -- | appRTyCon :: ToTypeable r => TCEmb TyCon -> TyConMap -> RTyCon -> [RRType r] -> (RTyCon, [RPVar]) typeUniqueSymbol :: Type -> Symbol -- | Binders generated by class predicates, typically for constraining -- tyvars (e.g. FNum) classBinds :: TCEmb TyCon -> SpecType -> [(Symbol, SortedReft)] isSizeable :: HashSet TyCon -> TyCon -> Bool famInstTyConType :: TyCon -> Maybe Type -- | famInstArgs c destructs a family-instance TyCon into -- its components, e.g. e.g. 'famInstArgs R:FieldBlob' is (Field, -- [Blob]) famInstArgs :: TyCon -> Maybe (TyCon, [Type]) strengthen :: Reftable r => RType c tv r -> r -> RType c tv r generalize :: (Eq tv, Monoid r) => RType c tv r -> RType c tv r normalizePds :: OkRT c tv r => RType c tv r -> RType c tv r dataConMsReft :: Reftable r => RType c tv r -> [Symbol] -> Reft dataConReft :: DataCon -> [Symbol] -> Reft -- | -- -- We use toType to convert RType to GHC.Type to expand any GHC -- related type-aliases, e.g. in Bare.Resolve.expandRTypeSynonyms. If the -- RType has a RHole then what to do? -- -- We, encode RHole as `LitTy LH_HOLE` -- which is a bit of -- a *hack*. The only saving grace is it is used *temporarily* and then -- swiftly turned back into an RHole via ofType (after GHC -- has done its business of expansion). -- -- Of course, we hope this doesn't break any GHC invariants! See issue -- 1477 -- -- The other option is to *not* use toType on things that have -- holes in them, but this seems worse, e.g. because you may define a -- plain GHC alias like: -- -- type ToNat a = a -> Nat -- -- and then you might write refinement types like: -- -- and we'd want to expand the above to -- -- and then resolve the hole using the (GHC) type of foo. -- -- Annotations and Solutions -- ------------------------------------------------- rTypeSortedReft :: (PPrint r, Reftable r, SubsTy RTyVar (RType RTyCon RTyVar ()) r, Reftable (RTProp RTyCon RTyVar r)) => TCEmb TyCon -> RRType r -> SortedReft rTypeSort :: (PPrint r, Reftable r, SubsTy RTyVar (RType RTyCon RTyVar ()) r, Reftable (RTProp RTyCon RTyVar r)) => TCEmb TyCon -> RRType r -> Sort -- | From Old Fixpoint -- --------------------------------------------------------- typeSort :: TCEmb TyCon -> Type -> Sort shiftVV :: (TyConable c, Reftable (f Reft), Functor f) => RType c tv (f Reft) -> Symbol -> RType c tv (f Reft) expandProductType :: (PPrint r, Reftable r, SubsTy RTyVar (RType RTyCon RTyVar ()) r, Reftable (RTProp RTyCon RTyVar r)) => Var -> RType RTyCon RTyVar r -> RType RTyCon RTyVar r mkTyConInfo :: TyCon -> VarianceInfo -> VarianceInfo -> Maybe SizeFun -> TyConInfo strengthenRefTypeGen :: (OkRT c tv r, FreeVar c tv, SubsTy tv (RType c tv ()) (RType c tv ()), SubsTy tv (RType c tv ()) c, SubsTy tv (RType c tv ()) r, SubsTy tv (RType c tv ()) tv, SubsTy tv (RType c tv ()) (RTVar tv (RType c tv ()))) => RType c tv r -> RType c tv r -> RType c tv r strengthenDataConType :: (Var, SpecType) -> (Var, SpecType) isBaseTy :: Type -> Bool updateRTVar :: Monoid r => RTVar RTyVar i -> RTVar RTyVar (RType RTyCon RTyVar r) isValKind :: Kind -> Bool kindToRType :: Monoid r => Type -> RRType r rTVarInfo :: Monoid r => TyVar -> RTVInfo (RRType r) -- | tyVarsPosition t returns the type variables appearing | (in positive -- positions, in negative positions, in undetermined positions) | -- undetermined positions are due to type constructors and type -- application tyVarsPosition :: RType RTyCon tv r -> Positions tv data Positions a Pos :: [a] -> [a] -> [a] -> Positions a [ppos] :: Positions a -> [a] [pneg] :: Positions a -> [a] [punknown] :: Positions a -> [a] isNumeric :: TCEmb TyCon -> RTyCon -> Bool instance GHC.Base.Monoid (Language.Haskell.Liquid.Types.RefType.Positions a) instance GHC.Base.Semigroup (Language.Haskell.Liquid.Types.RefType.Positions a) instance (Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RType c tv ()), Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) c, Language.Haskell.Liquid.Types.Types.OkRT c tv r, Language.Haskell.Liquid.Types.RefType.FreeVar c tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) r, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RTVar tv (Language.Haskell.Liquid.Types.Types.RType c tv ()))) => GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.RType c tv r) instance (Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RType c tv ()), Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) c, Language.Haskell.Liquid.Types.Types.OkRT c tv r, Language.Haskell.Liquid.Types.RefType.FreeVar c tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) r, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RTVar tv (Language.Haskell.Liquid.Types.Types.RType c tv ()))) => GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.RType c tv r) instance (Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) c, Language.Haskell.Liquid.Types.Types.OkRT c tv r, Language.Haskell.Liquid.Types.RefType.FreeVar c tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) r, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RType c tv ()), Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RTVar tv (Language.Haskell.Liquid.Types.Types.RType c tv ()))) => GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Types.RTProp c tv r) instance (Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) c, Language.Haskell.Liquid.Types.Types.OkRT c tv r, Language.Haskell.Liquid.Types.RefType.FreeVar c tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) r, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RType c tv ()), Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) tv, Language.Haskell.Liquid.Types.Types.SubsTy tv (Language.Haskell.Liquid.Types.Types.RType c tv ()) (Language.Haskell.Liquid.Types.Types.RTVar tv (Language.Haskell.Liquid.Types.Types.RType c tv ()))) => GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.RTProp c tv r) instance Language.Haskell.Liquid.Types.RefType.FreeVar Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar instance Language.Haskell.Liquid.Types.RefType.FreeVar Language.Haskell.Liquid.Types.Types.BTyCon Language.Haskell.Liquid.Types.Types.BTyVar instance Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar (Language.Haskell.Liquid.Types.Types.UReft Language.Fixpoint.Types.Refinements.Reft)) instance Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar ()) instance Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.BTyCon Language.Haskell.Liquid.Types.Types.BTyVar (Language.Haskell.Liquid.Types.Types.UReft Language.Fixpoint.Types.Refinements.Reft)) instance Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.BTyCon Language.Haskell.Liquid.Types.Types.BTyVar ()) instance Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar Language.Fixpoint.Types.Refinements.Reft) instance Language.Fixpoint.Types.Refinements.Subable (Language.Haskell.Liquid.Types.Types.RRProp Language.Fixpoint.Types.Refinements.Reft) instance (Language.Fixpoint.Types.PrettyPrint.PPrint r, Language.Fixpoint.Types.Refinements.Reftable r, Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar ()) r, Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar r)) => Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar r) instance Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.BTyCon Language.Haskell.Liquid.Types.Types.BTyVar (Language.Haskell.Liquid.Types.Types.UReft Language.Fixpoint.Types.Refinements.Reft)) instance Language.Fixpoint.Types.PrettyPrint.Fixpoint GHC.Base.String instance Language.Fixpoint.Types.PrettyPrint.Fixpoint Class.Class instance (GHC.Classes.Eq c, GHC.Classes.Eq tv, Data.Hashable.Class.Hashable tv, Language.Fixpoint.Types.PrettyPrint.PPrint tv, Language.Haskell.Liquid.Types.Types.TyConable c, Language.Fixpoint.Types.PrettyPrint.PPrint c, Language.Fixpoint.Types.Refinements.Reftable (Language.Haskell.Liquid.Types.Types.RTProp c tv ())) => GHC.Classes.Eq (Language.Haskell.Liquid.Types.Types.RType c tv ()) instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.RTyVar instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Types.RTyVar instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.RTyVar instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.RTyCon instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar ()) Language.Haskell.Liquid.Types.Types.RTyVar instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar ()) (Language.Haskell.Liquid.Types.Types.RTVar Language.Haskell.Liquid.Types.Types.RTyVar (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.RTyCon Language.Haskell.Liquid.Types.Types.RTyVar ())) instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.BTyVar (Language.Haskell.Liquid.Types.Types.RType c Language.Haskell.Liquid.Types.Types.BTyVar ()) Language.Haskell.Liquid.Types.Types.BTyVar instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.BTyVar (Language.Haskell.Liquid.Types.Types.RType c Language.Haskell.Liquid.Types.Types.BTyVar ()) (Language.Haskell.Liquid.Types.Types.RTVar Language.Haskell.Liquid.Types.Types.BTyVar (Language.Haskell.Liquid.Types.Types.RType c Language.Haskell.Liquid.Types.Types.BTyVar ())) instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty () instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty Language.Fixpoint.Types.Names.Symbol instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty Language.Fixpoint.Types.Refinements.Expr => Language.Haskell.Liquid.Types.Types.SubsTy tv ty Language.Fixpoint.Types.Refinements.Reft instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Fixpoint.Types.Names.Symbol Language.Fixpoint.Types.Names.Symbol (Language.Haskell.Liquid.Types.Types.BRType r) instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Fixpoint.Types.Names.Symbol Language.Fixpoint.Types.Names.Symbol (Language.Haskell.Liquid.Types.Types.RTProp Language.Haskell.Liquid.Types.Types.BTyCon Language.Haskell.Liquid.Types.Types.BTyVar r) instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty Language.Fixpoint.Types.Sorts.Sort => Language.Haskell.Liquid.Types.Types.SubsTy tv ty Language.Fixpoint.Types.Refinements.Expr instance (Language.Haskell.Liquid.Types.Types.SubsTy tv ty a, Language.Haskell.Liquid.Types.Types.SubsTy tv ty b) => Language.Haskell.Liquid.Types.Types.SubsTy tv ty (a, b) instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.BTyVar (Language.Haskell.Liquid.Types.Types.RType Language.Haskell.Liquid.Types.Types.BTyCon Language.Haskell.Liquid.Types.Types.BTyVar ()) Language.Fixpoint.Types.Sorts.Sort instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Fixpoint.Types.Names.Symbol Language.Haskell.Liquid.Types.Types.RSort Language.Fixpoint.Types.Sorts.Sort instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.RSort Language.Fixpoint.Types.Sorts.Sort instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty ty => Language.Haskell.Liquid.Types.Types.SubsTy tv ty (Language.Haskell.Liquid.Types.Types.PVKind ty) instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty ty => Language.Haskell.Liquid.Types.Types.SubsTy tv ty (Language.Haskell.Liquid.Types.Types.PVar ty) instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.RSort Language.Haskell.Liquid.Types.Types.RTyCon instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.RSort Language.Haskell.Liquid.Types.Types.PrType instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.RSort Language.Haskell.Liquid.Types.Types.SpecType instance Language.Haskell.Liquid.Types.Types.SubsTy Var.TyVar TyCoRep.Type Language.Haskell.Liquid.Types.Types.SpecType instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.SpecType instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.RTyVar Language.Haskell.Liquid.Types.Types.RSort Language.Haskell.Liquid.Types.Types.RSort instance Language.Haskell.Liquid.Types.Types.SubsTy tv Language.Haskell.Liquid.Types.Types.RSort Language.Haskell.Liquid.Types.Types.Predicate instance Language.Haskell.Liquid.Types.Types.SubsTy tv ty r => Language.Haskell.Liquid.Types.Types.SubsTy tv ty (Language.Haskell.Liquid.Types.Types.UReft r) instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.BTyVar Language.Haskell.Liquid.Types.Types.BSort Language.Haskell.Liquid.Types.Types.BTyCon instance Language.Haskell.Liquid.Types.Types.SubsTy Language.Haskell.Liquid.Types.Types.BTyVar Language.Haskell.Liquid.Types.Types.BSort Language.Haskell.Liquid.Types.Types.BSort instance (Language.Haskell.Liquid.Types.Types.SubsTy tv ty (Language.Haskell.Liquid.Types.Types.UReft r), Language.Haskell.Liquid.Types.Types.SubsTy tv ty (Language.Haskell.Liquid.Types.Types.RType c tv ())) => Language.Haskell.Liquid.Types.Types.SubsTy tv ty (Language.Haskell.Liquid.Types.Types.RTProp c tv (Language.Haskell.Liquid.Types.Types.UReft r)) instance Language.Fixpoint.Types.Refinements.Expression Var.Var instance (GHC.Show.Show tv, GHC.Show.Show ty) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RTAlias tv ty) instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.RTyVar instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.UReft r) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.UReft r) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.DataDecl instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.DataCtor instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RType c tv r) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RType c tv r) instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.RTProp c tv r) => GHC.Show.Show (Language.Haskell.Liquid.Types.Types.RTProp c tv r) -- | This module contains functions for cleaning up types before they are -- rendered, e.g. in error messages or annoations, and also some PPrint -- instances that rely upon tidying. module Language.Haskell.Liquid.UX.Tidy tidySpecType :: Tidy -> SpecType -> SpecType tidySymbol :: Symbol -> Symbol -- | This function is put in this module as it depends on the Exception -- instance, which depends on the PPrint instance, which depends on -- tidySpecType. -- -- Show an Error, then crash panicError :: Error -> a -- | Converting Results To Answers ------------------------------------- class Result a result :: Result a => a -> FixResult UserError errorToUserError :: Error -> UserError cinfoError :: Cinfo -> Error instance Language.Haskell.Liquid.UX.Tidy.Result Language.Haskell.Liquid.Types.Errors.UserError instance Language.Haskell.Liquid.UX.Tidy.Result [Language.Haskell.Liquid.Types.Types.Error] instance Language.Haskell.Liquid.UX.Tidy.Result Language.Haskell.Liquid.Types.Types.Error instance Language.Haskell.Liquid.UX.Tidy.Result (Language.Fixpoint.Types.Errors.FixResult Language.Haskell.Liquid.Types.Types.Cinfo) instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Errors.CtxError Text.PrettyPrint.HughesPJ.Doc) instance Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Errors.CtxError Language.Haskell.Liquid.Types.Types.SpecType) instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.Error instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.Error instance GHC.Exception.Type.Exception Language.Haskell.Liquid.Types.Types.Error instance GHC.Exception.Type.Exception [Language.Haskell.Liquid.Types.Types.Error] module Language.Haskell.Liquid.Types.PredType type PrType = RRType Predicate data TyConP TyConP :: !SourcePos -> !TyCon -> ![RTyVar] -> ![PVar RSort] -> !VarianceInfo -> !VarianceInfo -> !Maybe SizeFun -> TyConP [tcpLoc] :: TyConP -> !SourcePos [tcpCon] :: TyConP -> !TyCon [tcpFreeTyVarsTy] :: TyConP -> ![RTyVar] [tcpFreePredTy] :: TyConP -> ![PVar RSort] [tcpVarianceTs] :: TyConP -> !VarianceInfo [tcpVariancePs] :: TyConP -> !VarianceInfo [tcpSizeFun] :: TyConP -> !Maybe SizeFun data DataConP DataConP :: !SourcePos -> !DataCon -> ![RTyVar] -> ![PVar RSort] -> ![SpecType] -> ![(Symbol, SpecType)] -> !SpecType -> !Bool -> !Symbol -> !SourcePos -> DataConP [dcpLoc] :: DataConP -> !SourcePos -- | Corresponding GHC DataCon [dcpCon] :: DataConP -> !DataCon -- | Type parameters [dcpFreeTyVars] :: DataConP -> ![RTyVar] -- | Abstract Refinement parameters [dcpFreePred] :: DataConP -> ![PVar RSort] -- | ? Class constraints (via dataConStupidTheta) [dcpTyConstrs] :: DataConP -> ![SpecType] -- | Value parameters [dcpTyArgs] :: DataConP -> ![(Symbol, SpecType)] -- | Result type , tyData :: !SpecType -- ^ The generic ADT, see -- [NOTE:DataCon-Data] [dcpTyRes] :: DataConP -> !SpecType -- | Was this specified in GADT style (if so, DONT use function names as -- fields) [dcpIsGadt] :: DataConP -> !Bool -- | Which module was this defined in [dcpModule] :: DataConP -> !Symbol [dcpLocE] :: DataConP -> !SourcePos dataConTy :: Monoid r => HashMap RTyVar (RType RTyCon RTyVar r) -> Type -> RType RTyCon RTyVar r -- | dataConPSpecType converts a DataConP, LH's internal -- representation for a (refined) data constructor into a -- SpecType for that constructor. TODO: duplicated with -- Liquid.Measure.makeDataConType dataConPSpecType :: DataConP -> [(Var, SpecType)] makeTyConInfo :: TCEmb TyCon -> [TyCon] -> [TyConP] -> TyConMap -- | Instantiate PVar with RTProp -- ----------------------------------------------- -- -- replacePreds is the main function used to substitute an -- (abstract) predicate with a concrete Ref, that is either an -- RProp or RHProp type. The substitution is invoked to -- obtain the SpecType resulting at predicate application -- sites in Constraint. The range of the PVar substitutions -- are fresh or true RefType. That is, there are -- no further _quantified_ PVar in the target. replacePreds :: String -> SpecType -> [(RPVar, SpecProp)] -> SpecType -- | Interface: Replace Predicate With Uninterpreted Function Symbol -- ------- replacePredsWithRefs :: (UsedPVar, (Symbol, [((), Symbol, Expr)]) -> Expr) -> UReft Reft -> UReft Reft pVartoRConc :: PVar t -> (Symbol, [(a, b, Expr)]) -> Expr -- | Interface: Modified CoreSyn.exprType due to predApp -- ------------------- predType :: Type -- | pvarRType π returns a trivial RType corresponding to -- the function signature for a PVar π. For example, if -- π :: T1 -> T2 -> T3 -> Prop then pvarRType -- π returns an RType with an RTycon called -- predRTyCon `RApp predRTyCon [T1, T2, T3]` pvarRType :: (PPrint r, Reftable r) => PVar RSort -> RRType r substParg :: Functor f => (Symbol, Expr) -> f Predicate -> f Predicate pApp :: Symbol -> [Expr] -> Expr pappSort :: Int -> Sort pappArity :: Int dataConWorkRep :: DataCon -> SpecRep instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.TyConP instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.TyConP instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.DataConP instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.DataConP module Language.Haskell.Liquid.WiredIn wiredTyCons :: [TyConP] wiredDataCons :: [Located DataConP] wiredSortedSyms :: [(Symbol, Sort)] -- | LH Primitive TyCons -- ------------------------------------------------------- dictionaryVar :: Var dictionaryTyVar :: TyVar dictionaryBind :: Bind Var proofTyConName :: Symbol -- | LH Primitive TyCons ---------------------------------------------- combineProofsName :: String -- | Horrible hack to support hardwired symbols like head, -- tail, fst, snd and other LH generated symbols -- that *do not* correspond to GHC Vars and *should not* be resolved to -- GHC Vars. isWiredIn :: LocSymbol -> Bool isWiredInName :: Symbol -> Bool dcPrefix :: Symbol isDerivedInstance :: ClsInst -> Bool -- | This code has various wrappers around meet and -- strengthen that are here so that we can throw decent error -- messages if they fail. The module depends on RefType and -- Tidy. module Language.Haskell.Liquid.Types.Meet meetVarTypes :: TCEmb TyCon -> Doc -> (SrcSpan, SpecType) -> (SrcSpan, SpecType) -> SpecType module Language.Haskell.Liquid.Types.Fresh class (Applicative m, Monad m) => Freshable m a fresh :: Freshable m a => m a true :: Freshable m a => a -> m a refresh :: Freshable m a => a -> m a refreshTy :: FreshM m => SpecType -> m SpecType refreshVV :: FreshM m => SpecType -> m SpecType refreshArgs :: FreshM m => SpecType -> m SpecType refreshHoles :: (Symbolic t, Reftable r, TyConable c, Freshable f r) => [(t, RType c tv r)] -> f ([Symbol], [(t, RType c tv r)]) refreshArgsSub :: FreshM m => SpecType -> m (SpecType, Subst) instance (Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Integer.Type.Integer, GHC.Base.Monad m, GHC.Base.Applicative m) => Language.Haskell.Liquid.Types.Fresh.Freshable m Language.Fixpoint.Types.Names.Symbol instance (Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Integer.Type.Integer, GHC.Base.Monad m, GHC.Base.Applicative m) => Language.Haskell.Liquid.Types.Fresh.Freshable m Language.Fixpoint.Types.Refinements.Expr instance (Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Integer.Type.Integer, GHC.Base.Monad m, GHC.Base.Applicative m) => Language.Haskell.Liquid.Types.Fresh.Freshable m [Language.Fixpoint.Types.Refinements.Expr] instance (Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Integer.Type.Integer, GHC.Base.Monad m, GHC.Base.Applicative m) => Language.Haskell.Liquid.Types.Fresh.Freshable m Language.Fixpoint.Types.Refinements.Reft instance Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Integer.Type.Integer => Language.Haskell.Liquid.Types.Fresh.Freshable m Language.Haskell.Liquid.Types.Types.RReft instance (Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Integer.Type.Integer, Language.Haskell.Liquid.Types.Fresh.Freshable m r, Language.Fixpoint.Types.Refinements.Reftable r) => Language.Haskell.Liquid.Types.Fresh.Freshable m (Language.Haskell.Liquid.Types.Types.RRType r) module Language.Haskell.Liquid.Types.Dictionaries makeDictionaries :: [RInstance LocSpecType] -> DEnv Symbol LocSpecType makeDictionary :: RInstance LocSpecType -> (Symbol, HashMap Symbol (RISig LocSpecType)) -- | Dictionary Environment -- ---------------------------------------------------- dfromList :: [(Var, HashMap Symbol (RISig t))] -> DEnv Var t dmapty :: (a -> b) -> DEnv v a -> DEnv v b dmap :: (v1 -> v2) -> HashMap k v1 -> HashMap k v2 dinsert :: (Eq x, Hashable x) => DEnv x ty -> x -> HashMap Symbol (RISig ty) -> DEnv x ty dlookup :: (Eq k, Hashable k) => DEnv k t -> k -> Maybe (HashMap Symbol (RISig t)) dhasinfo :: (Symbolic a1, Show a) => Maybe (HashMap Symbol a) -> a1 -> Maybe a fromRISig :: RISig a -> a module Language.Haskell.Liquid.Types.Bounds data Bound t e Bound :: LocSymbol -> [t] -> [(LocSymbol, t)] -> [(LocSymbol, t)] -> e -> Bound t e -- | The name of the bound [bname] :: Bound t e -> LocSymbol -- | Type variables that appear in the bounds [tyvars] :: Bound t e -> [t] -- | These are abstract refinements, for now [bparams] :: Bound t e -> [(LocSymbol, t)] -- | These are value variables [bargs] :: Bound t e -> [(LocSymbol, t)] -- | The body of the bound [bbody] :: Bound t e -> e type RBound = RRBound RSort type RRBound tv = Bound tv Expr type RBEnv = HashMap LocSymbol RBound type RRBEnv tv = HashMap LocSymbol (RRBound tv) makeBound :: (PPrint r, UReftable r, SubsTy RTyVar (RType RTyCon RTyVar ()) r) => RRBound RSort -> [RRType r] -> [Symbol] -> RRType r -> RRType r instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance (Data.Data.Data t, Data.Data.Data e) => Data.Data.Data (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance (Data.Binary.Class.Binary t, Data.Binary.Class.Binary e) => Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance Data.Hashable.Class.Hashable (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance GHC.Classes.Eq (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance (Language.Fixpoint.Types.PrettyPrint.PPrint e, Language.Fixpoint.Types.PrettyPrint.PPrint t) => GHC.Show.Show (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance (Language.Fixpoint.Types.PrettyPrint.PPrint e, Language.Fixpoint.Types.PrettyPrint.PPrint t) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Bounds.Bound t e) instance Data.Bifunctor.Bifunctor Language.Haskell.Liquid.Types.Bounds.Bound -- | This module contains the top-level structures that hold information -- about specifications. module Language.Haskell.Liquid.Types.Specs data TargetInfo TargetInfo :: !TargetSrc -> !TargetSpec -> TargetInfo -- | The TargetSrc of the module being checked. [giSrc] :: TargetInfo -> !TargetSrc -- | The TargetSpec of the module being checked. [giSpec] :: TargetInfo -> !TargetSpec -- | The TargetSrc type is a collection of all the things we know -- about a module being currently checked. It include things like the -- name of the module, the list of CoreBinds, the TyCons -- declared in this module (that includes TyCons for classes), -- typeclass instances and so and so forth. It might be consider a sort -- of ModGuts embellished with LH-specific information (for -- example, giDefVars are populated with datacons from the module -- plus the let vars derived from the A-normalisation). data TargetSrc TargetSrc :: !FilePath -> !FilePath -> !ModName -> ![CoreBind] -> ![TyCon] -> !Maybe [ClsInst] -> !HashSet Var -> ![Var] -> ![Var] -> ![Var] -> !HashSet StableName -> ![TyCon] -> ![(Symbol, DataCon)] -> ![TyCon] -> !QImports -> !HashSet Symbol -> ![TyThing] -> TargetSrc -- | Path for LH include/prelude directory [giIncDir] :: TargetSrc -> !FilePath -- | Source file for module [giTarget] :: TargetSrc -> !FilePath -- | Name for module [giTargetMod] :: TargetSrc -> !ModName -- | Source Code [giCbs] :: TargetSrc -> ![CoreBind] -- | All used Type constructors [gsTcs] :: TargetSrc -> ![TyCon] -- | Class instances? [gsCls] :: TargetSrc -> !Maybe [ClsInst] -- | Binders created by GHC eg dictionaries [giDerVars] :: TargetSrc -> !HashSet Var -- | Binders that are _read_ in module (but not defined?) [giImpVars] :: TargetSrc -> ![Var] -- | (Top-level) binders that are _defined_ in module [giDefVars] :: TargetSrc -> ![Var] -- | Binders that are _read_ in module [giUseVars] :: TargetSrc -> ![Var] -- | Names exported by the module being verified [gsExports] :: TargetSrc -> !HashSet StableName -- | Family instance TyCons [gsFiTcs] :: TargetSrc -> ![TyCon] -- | Family instance DataCons [gsFiDcs] :: TargetSrc -> ![(Symbol, DataCon)] -- | Primitive GHC TyCons (from TysPrim.primTyCons) [gsPrimTcs] :: TargetSrc -> ![TyCon] -- | Map of qualified imports [gsQualImps] :: TargetSrc -> !QImports -- | Set of _all_ imported modules [gsAllImps] :: TargetSrc -> !HashSet Symbol -- | All the TyThings known to GHC [gsTyThings] :: TargetSrc -> ![TyThing] -- | A TargetSpec is what we actually check via -- LiquidHaskell. It is created as part of mkTargetSpec -- alongside the LiftedSpec. It shares a similar structure with a -- BareSpec, but manipulates and transforms the data in -- preparation to the checking process. data TargetSpec TargetSpec :: !GhcSpecSig -> !GhcSpecQual -> !GhcSpecData -> !GhcSpecNames -> !GhcSpecVars -> !GhcSpecTerm -> !GhcSpecRefl -> !GhcSpecLaws -> ![(Symbol, Sort)] -> !Config -> TargetSpec [gsSig] :: TargetSpec -> !GhcSpecSig [gsQual] :: TargetSpec -> !GhcSpecQual [gsData] :: TargetSpec -> !GhcSpecData [gsName] :: TargetSpec -> !GhcSpecNames [gsVars] :: TargetSpec -> !GhcSpecVars [gsTerm] :: TargetSpec -> !GhcSpecTerm [gsRefl] :: TargetSpec -> !GhcSpecRefl [gsLaws] :: TargetSpec -> !GhcSpecLaws -- | Imported Environment [gsImps] :: TargetSpec -> ![(Symbol, Sort)] [gsConfig] :: TargetSpec -> !Config -- | A BareSpec is the spec we derive by parsing the Liquid Haskell -- annotations of a single file. As such, it contains things which are -- relevant for validation and lifting; it contains things like the -- pragmas the user defined, the termination condition (if -- termination-checking is enabled) and so on and so forth. -- Crucially, as a BareSpec is still subject to "preflight -- checks", it may contain duplicates (e.g. duplicate measures, duplicate -- type declarations etc.) and therefore most of the fields for a -- BareSpec are lists, so that we can report these errors to the -- end user: it would be an error to silently ignore the duplication and -- leave the duplicate resolution to whichever Eq instance is -- implemented for the relevant field. -- -- Also, a BareSpec has not yet been subject to name resolution, -- so it may refer to undefined or out-of-scope entities. newtype BareSpec MkBareSpec :: Spec LocBareType LocSymbol -> BareSpec [getBareSpec] :: BareSpec -> Spec LocBareType LocSymbol -- | A LiftedSpec is derived from an input BareSpec and a set -- of its dependencies. The general motivations for lifting a spec are -- (a) name resolution, (b) the fact that some info is only relevant for -- checking the body of functions but does not need to be exported, e.g. -- termination measures, or the fact that a type signature was assumed. A -- LiftedSpec is what we serialise on disk and what the clients -- should will be using. -- -- What we do not have compared to a BareSpec: -- -- -- -- Apart from less fields, a LiftedSpec replaces all instances -- of lists with sets, to enforce duplicate detection and removal on -- what we serialise on disk. data LiftedSpec LiftedSpec :: HashSet (Measure LocBareType LocSymbol) -> HashSet (Symbol, Sort) -> HashSet (Symbol, Sort) -> HashSet (LocSymbol, LocBareType) -> HashSet (LocSymbol, LocBareType) -> HashSet (Maybe LocSymbol, LocBareType) -> HashSet (LocBareType, LocBareType) -> HashSet Symbol -> HashSet DataDecl -> HashSet DataDecl -> HashSet (Located (RTAlias Symbol BareType)) -> HashSet (Located (RTAlias Symbol Expr)) -> TCEmb LocSymbol -> HashSet Qualifier -> HashSet (LocSymbol, [Int]) -> HashSet LocSymbol -> HashMap LocSymbol (Maybe Int) -> HashSet LocSymbol -> HashSet (Measure LocBareType ()) -> HashSet (Measure LocBareType LocSymbol) -> HashSet (RClass LocBareType) -> HashSet (RClass LocBareType) -> HashSet (RInstance LocBareType) -> HashSet (RILaws LocBareType) -> HashSet (LocSymbol, [Variance]) -> RRBEnv LocBareType -> HashMap LocSymbol Symbol -> HashSet Equation -> LiftedSpec -- | User-defined properties for ADTs [liftedMeasures] :: LiftedSpec -> HashSet (Measure LocBareType LocSymbol) -- | Imported variables types [liftedImpSigs] :: LiftedSpec -> HashSet (Symbol, Sort) -- | Exported variables types [liftedExpSigs] :: LiftedSpec -> HashSet (Symbol, Sort) -- | Assumed (unchecked) types; including reflected signatures [liftedAsmSigs] :: LiftedSpec -> HashSet (LocSymbol, LocBareType) -- | Imported functions and types [liftedSigs] :: LiftedSpec -> HashSet (LocSymbol, LocBareType) -- | Data type invariants; the Maybe is the generating measure [liftedInvariants] :: LiftedSpec -> HashSet (Maybe LocSymbol, LocBareType) -- | Data type invariants to be checked [liftedIaliases] :: LiftedSpec -> HashSet (LocBareType, LocBareType) -- | Loaded spec module names [liftedImports] :: LiftedSpec -> HashSet Symbol -- | Predicated data definitions [liftedDataDecls] :: LiftedSpec -> HashSet DataDecl -- | Predicated new type definitions [liftedNewtyDecls] :: LiftedSpec -> HashSet DataDecl -- | RefType aliases [liftedAliases] :: LiftedSpec -> HashSet (Located (RTAlias Symbol BareType)) -- | Expression aliases [liftedEaliases] :: LiftedSpec -> HashSet (Located (RTAlias Symbol Expr)) -- | GHC-Tycon-to-fixpoint Tycon map [liftedEmbeds] :: LiftedSpec -> TCEmb LocSymbol -- | Qualifiers in source/spec files [liftedQualifiers] :: LiftedSpec -> HashSet Qualifier -- | Information on decreasing arguments [liftedDecr] :: LiftedSpec -> HashSet (LocSymbol, [Int]) -- | Variables that should be checked in the environment they are used [liftedLvars] :: LiftedSpec -> HashSet LocSymbol -- | Automatically instantiate axioms in these Functions with maybe -- specified fuel [liftedAutois] :: LiftedSpec -> HashMap LocSymbol (Maybe Int) -- | Type Constructors that get automatically sizing info [liftedAutosize] :: LiftedSpec -> HashSet LocSymbol -- | Measures attached to a type-class [liftedCmeasures] :: LiftedSpec -> HashSet (Measure LocBareType ()) -- | Mappings from (measure,type) -> measure [liftedImeasures] :: LiftedSpec -> HashSet (Measure LocBareType LocSymbol) -- | Refined Type-Classes [liftedClasses] :: LiftedSpec -> HashSet (RClass LocBareType) -- | Refined Type-Classe Laws [liftedClaws] :: LiftedSpec -> HashSet (RClass LocBareType) [liftedRinstance] :: LiftedSpec -> HashSet (RInstance LocBareType) [liftedIlaws] :: LiftedSpec -> HashSet (RILaws LocBareType) -- | ? Where do these come from ?! [liftedDvariance] :: LiftedSpec -> HashSet (LocSymbol, [Variance]) [liftedBounds] :: LiftedSpec -> RRBEnv LocBareType -- | Temporary (?) hack to deal with dictionaries in specifications see -- testsposNatClass.hs [liftedDefs] :: LiftedSpec -> HashMap LocSymbol Symbol -- | Equalities used for Proof-By-Evaluation [liftedAxeqs] :: LiftedSpec -> HashSet Equation -- | A newtype wrapper around a Module which: -- -- newtype StableModule StableModule :: Module -> StableModule [unStableModule] :: StableModule -> Module -- | Converts a Module into a StableModule. toStableModule :: Module -> StableModule renderModule :: Module -> String -- | The target dependencies that concur to the creation of a -- TargetSpec and a LiftedSpec. newtype TargetDependencies TargetDependencies :: HashMap StableModule LiftedSpec -> TargetDependencies [getDependencies] :: TargetDependencies -> HashMap StableModule LiftedSpec -- | Drop the given StableModule from the dependencies. dropDependency :: StableModule -> TargetDependencies -> TargetDependencies -- | Returns True if the input Var is a PLE one. isPLEVar :: TargetSpec -> Var -> Bool -- | Returns True if the input Var was exported in the module -- the input TargetSrc represents. isExportedVar :: TargetSrc -> Var -> Bool -- | QImports is a map of qualified imports. data QImports QImports :: !HashSet Symbol -> !HashMap Symbol [Symbol] -> QImports -- | All the modules that are imported qualified [qiModules] :: QImports -> !HashSet Symbol -- | Map from qualification to full module name [qiNames] :: QImports -> !HashMap Symbol [Symbol] -- | A generic Spec type, polymorphic over the inner choice of type -- and binder. data Spec ty bndr Spec :: ![Measure ty bndr] -> ![(Symbol, Sort)] -> ![(Symbol, Sort)] -> ![(LocSymbol, ty)] -> ![(LocSymbol, ty)] -> ![(LocSymbol, ty)] -> ![(LocSymbol, ty)] -> ![(Maybe LocSymbol, ty)] -> ![(ty, ty)] -> ![Symbol] -> ![DataDecl] -> ![DataDecl] -> ![FilePath] -> ![Located (RTAlias Symbol BareType)] -> ![Located (RTAlias Symbol Expr)] -> !TCEmb LocSymbol -> ![Qualifier] -> ![(LocSymbol, [Int])] -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashMap LocSymbol [LocSymbol] -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashMap LocSymbol (Maybe Int) -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> ![Located String] -> ![Measure ty ()] -> ![Measure ty bndr] -> ![RClass ty] -> ![RClass ty] -> ![(LocSymbol, [Located Expr])] -> ![RInstance ty] -> ![RILaws ty] -> ![(LocSymbol, [Variance])] -> !RRBEnv ty -> !HashMap LocSymbol Symbol -> ![Equation] -> Spec ty bndr -- | User-defined properties for ADTs [measures] :: Spec ty bndr -> ![Measure ty bndr] -- | Imported variables types [impSigs] :: Spec ty bndr -> ![(Symbol, Sort)] -- | Exported variables types [expSigs] :: Spec ty bndr -> ![(Symbol, Sort)] -- | Assumed (unchecked) types; including reflected signatures [asmSigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Imported functions and types [sigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Local type signatures [localSigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Reflected type signatures [reflSigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Data type invariants; the Maybe is the generating measure [invariants] :: Spec ty bndr -> ![(Maybe LocSymbol, ty)] -- | Data type invariants to be checked [ialiases] :: Spec ty bndr -> ![(ty, ty)] -- | Loaded spec module names [imports] :: Spec ty bndr -> ![Symbol] -- | Predicated data definitions [dataDecls] :: Spec ty bndr -> ![DataDecl] -- | Predicated new type definitions [newtyDecls] :: Spec ty bndr -> ![DataDecl] -- | Included qualifier files [includes] :: Spec ty bndr -> ![FilePath] -- | RefType aliases [aliases] :: Spec ty bndr -> ![Located (RTAlias Symbol BareType)] -- | Expression aliases [ealiases] :: Spec ty bndr -> ![Located (RTAlias Symbol Expr)] -- | GHC-Tycon-to-fixpoint Tycon map [embeds] :: Spec ty bndr -> !TCEmb LocSymbol -- | Qualifiers in source/spec files [qualifiers] :: Spec ty bndr -> ![Qualifier] -- | Information on decreasing arguments [decr] :: Spec ty bndr -> ![(LocSymbol, [Int])] -- | Variables that should be checked in the environment they are used [lvars] :: Spec ty bndr -> !HashSet LocSymbol -- | Ignore Termination Check in these Functions [lazy] :: Spec ty bndr -> !HashSet LocSymbol -- | Theorems turned into rewrite rules [rewrites] :: Spec ty bndr -> !HashSet LocSymbol -- | Definitions using rewrite rules [rewriteWith] :: Spec ty bndr -> !HashMap LocSymbol [LocSymbol] -- | These Functions should be unsafe [fails] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to reflect [reflects] :: Spec ty bndr -> !HashSet LocSymbol -- | Automatically instantiate axioms in these Functions with maybe -- specified fuel [autois] :: Spec ty bndr -> !HashMap LocSymbol (Maybe Int) -- | Binders to turn into measures using haskell definitions [hmeas] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to turn into bounds using haskell definitions [hbounds] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to turn into logic inline using haskell definitions [inlines] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to ignore during checking; that is DON't check the corebind. [ignores] :: Spec ty bndr -> !HashSet LocSymbol -- | Type Constructors that get automatically sizing info [autosize] :: Spec ty bndr -> !HashSet LocSymbol -- | Command-line configurations passed in through source [pragmas] :: Spec ty bndr -> ![Located String] -- | Measures attached to a type-class [cmeasures] :: Spec ty bndr -> ![Measure ty ()] -- | Mappings from (measure,type) -> measure [imeasures] :: Spec ty bndr -> ![Measure ty bndr] -- | Refined Type-Classes [classes] :: Spec ty bndr -> ![RClass ty] -- | Refined Type-Classe Laws [claws] :: Spec ty bndr -> ![RClass ty] -- | Terminating Conditions for functions [termexprs] :: Spec ty bndr -> ![(LocSymbol, [Located Expr])] [rinstance] :: Spec ty bndr -> ![RInstance ty] [ilaws] :: Spec ty bndr -> ![RILaws ty] -- | ? Where do these come from ?! [dvariance] :: Spec ty bndr -> ![(LocSymbol, [Variance])] [bounds] :: Spec ty bndr -> !RRBEnv ty -- | Temporary (?) hack to deal with dictionaries in specifications see -- testsposNatClass.hs [defs] :: Spec ty bndr -> !HashMap LocSymbol Symbol -- | Equalities used for Proof-By-Evaluation [axeqs] :: Spec ty bndr -> ![Equation] -- | The collection of GHC Vars that a TargetSpec needs to -- verify (or skip). data GhcSpecVars SpVar :: ![Var] -> !HashSet Var -> !HashSet Var -> ![Var] -> GhcSpecVars -- | Top-level Binders To Verify (empty means ALL binders) [gsTgtVars] :: GhcSpecVars -> ![Var] -- | Top-level Binders To NOT Verify (empty means ALL binders) [gsIgnoreVars] :: GhcSpecVars -> !HashSet Var -- | Variables that should be checked "lazily" in the environment they are -- used [gsLvars] :: GhcSpecVars -> !HashSet Var -- | Refined Class methods [gsCMethods] :: GhcSpecVars -> ![Var] data GhcSpecSig SpSig :: ![(Var, LocSpecType)] -> ![(Var, LocSpecType)] -> ![(Var, LocSpecType)] -> ![(Var, LocSpecType)] -> ![(TyCon, LocSpecType)] -> !DEnv Var LocSpecType -> ![(Var, MethodType LocSpecType)] -> ![(Var, LocSpecType, [Located Expr])] -> GhcSpecSig -- | Asserted Reftypes [gsTySigs] :: GhcSpecSig -> ![(Var, LocSpecType)] -- | Assumed Reftypes [gsAsmSigs] :: GhcSpecSig -> ![(Var, LocSpecType)] -- | Reflected Reftypes [gsRefSigs] :: GhcSpecSig -> ![(Var, LocSpecType)] -- | Auto generated Signatures [gsInSigs] :: GhcSpecSig -> ![(Var, LocSpecType)] -- | Mapping of 'newtype' type constructors with their refined types. [gsNewTypes] :: GhcSpecSig -> ![(TyCon, LocSpecType)] -- | Refined Classes from Instances [gsDicts] :: GhcSpecSig -> !DEnv Var LocSpecType -- | Refined Classes from Classes [gsMethods] :: GhcSpecSig -> ![(Var, MethodType LocSpecType)] -- | Lexicographically ordered expressions for termination [gsTexprs] :: GhcSpecSig -> ![(Var, LocSpecType, [Located Expr])] data GhcSpecNames SpNames :: ![(Symbol, Var)] -> ![Located DataCon] -> ![TyConP] -> !TCEmb TyCon -> ![DataDecl] -> !TyConMap -> GhcSpecNames -- | List of Symbol free in spec and corresponding GHC var, eg. -- (Cons, Cons#7uz) from testsposex1.hs [gsFreeSyms] :: GhcSpecNames -> ![(Symbol, Var)] -- | Predicated Data-Constructors, e.g. see testsposMap.hs [gsDconsP] :: GhcSpecNames -> ![Located DataCon] -- | Predicated Type-Constructors, e.g. see testsposMap.hs [gsTconsP] :: GhcSpecNames -> ![TyConP] -- | Embedding GHC Tycons into fixpoint sorts e.g. "embed Set as Set_set" -- from includeDataSet.spec [gsTcEmbeds] :: GhcSpecNames -> !TCEmb TyCon -- | ADTs extracted from Haskell 'data' definitions [gsADTs] :: GhcSpecNames -> ![DataDecl] [gsTyconEnv] :: GhcSpecNames -> !TyConMap data GhcSpecTerm SpTerm :: !HashSet Var -> !HashSet TyCon -> !HashSet Var -> !HashSet (Located Var) -> ![(Var, [Int])] -> !HashSet Var -> GhcSpecTerm -- | Binders to CHECK by structural termination [gsStTerm] :: GhcSpecTerm -> !HashSet Var -- | Binders to IGNORE during termination checking [gsAutosize] :: GhcSpecTerm -> !HashSet TyCon -- | Binders to IGNORE during termination checking [gsLazy] :: GhcSpecTerm -> !HashSet Var -- | Binders to fail type checking [gsFail] :: GhcSpecTerm -> !HashSet (Located Var) -- | Lexicographic order of decreasing args (DEPRECATED) [gsDecr] :: GhcSpecTerm -> ![(Var, [Int])] -- | Binders to CHECK using REFINEMENT-TYPES/termination metrics [gsNonStTerm] :: GhcSpecTerm -> !HashSet Var data GhcSpecRefl SpRefl :: !HashMap Var (Maybe Int) -> ![(Var, LocSpecType, Equation)] -> ![Equation] -> ![Equation] -> ![Var] -> !LogicMap -> ![Var] -> HashSet (Located Var) -> HashMap Var [Var] -> GhcSpecRefl -- | Binders to USE PLE [gsAutoInst] :: GhcSpecRefl -> !HashMap Var (Maybe Int) -- | Lifted definitions [gsHAxioms] :: GhcSpecRefl -> ![(Var, LocSpecType, Equation)] -- | Axioms from imported reflected functions [gsImpAxioms] :: GhcSpecRefl -> ![Equation] -- | Axioms from my reflected functions [gsMyAxioms] :: GhcSpecRefl -> ![Equation] -- | Binders for reflected functions [gsReflects] :: GhcSpecRefl -> ![Var] [gsLogicMap] :: GhcSpecRefl -> !LogicMap [gsWiredReft] :: GhcSpecRefl -> ![Var] [gsRewrites] :: GhcSpecRefl -> HashSet (Located Var) [gsRewritesWith] :: GhcSpecRefl -> HashMap Var [Var] data GhcSpecLaws SpLaws :: ![(Class, [(Var, LocSpecType)])] -> ![LawInstance] -> GhcSpecLaws [gsLawDefs] :: GhcSpecLaws -> ![(Class, [(Var, LocSpecType)])] [gsLawInst] :: GhcSpecLaws -> ![LawInstance] data GhcSpecData SpData :: ![(Var, LocSpecType)] -> ![(Symbol, LocSpecType)] -> ![(Maybe Var, LocSpecType)] -> ![(LocSpecType, LocSpecType)] -> ![Measure SpecType DataCon] -> ![UnSortedExpr] -> GhcSpecData -- | Data Constructor Measure Sigs [gsCtors] :: GhcSpecData -> ![(Var, LocSpecType)] -- | Measure Types eg. len :: [a] -> Int [gsMeas] :: GhcSpecData -> ![(Symbol, LocSpecType)] -- | Data type invariants from measure definitions, e.g forall a. {v: [a] | -- len(v) >= 0} [gsInvariants] :: GhcSpecData -> ![(Maybe Var, LocSpecType)] -- | Data type invariant aliases [gsIaliases] :: GhcSpecData -> ![(LocSpecType, LocSpecType)] -- | Measure definitions [gsMeasures] :: GhcSpecData -> ![Measure SpecType DataCon] [gsUnsorted] :: GhcSpecData -> ![UnSortedExpr] data GhcSpecQual SpQual :: ![Qualifier] -> ![Located SpecRTAlias] -> GhcSpecQual -- | Qualifiers in SourceSpec files e.g testspos/qualTest.hs [gsQualifiers] :: GhcSpecQual -> ![Qualifier] -- | Refinement type aliases (only used for qualifiers) [gsRTAliases] :: GhcSpecQual -> ![Located SpecRTAlias] type BareDef = Def LocBareType LocSymbol type BareMeasure = Measure LocBareType LocSymbol type SpecMeasure = Measure LocSpecType DataCon type VarOrLocSymbol = Either Var LocSymbol data LawInstance LawInstance :: Class -> [LocSpecType] -> [LocSpecType] -> [(VarOrLocSymbol, (VarOrLocSymbol, Maybe LocSpecType))] -> SrcSpan -> LawInstance [lilName] :: LawInstance -> Class [liSupers] :: LawInstance -> [LocSpecType] [lilTyArgs] :: LawInstance -> [LocSpecType] [lilEqus] :: LawInstance -> [(VarOrLocSymbol, (VarOrLocSymbol, Maybe LocSpecType))] [lilPos] :: LawInstance -> SrcSpan data GhcSrc Src :: !FilePath -> !FilePath -> !ModName -> ![CoreBind] -> ![TyCon] -> !Maybe [ClsInst] -> !HashSet Var -> ![Var] -> ![Var] -> ![Var] -> !HashSet StableName -> ![TyCon] -> ![(Symbol, DataCon)] -> ![TyCon] -> !QImports -> !HashSet Symbol -> ![TyThing] -> GhcSrc -- | Path for LH include/prelude directory [_giIncDir] :: GhcSrc -> !FilePath -- | Source file for module [_giTarget] :: GhcSrc -> !FilePath -- | Name for module [_giTargetMod] :: GhcSrc -> !ModName -- | Source Code [_giCbs] :: GhcSrc -> ![CoreBind] -- | All used Type constructors [_gsTcs] :: GhcSrc -> ![TyCon] -- | Class instances? [_gsCls] :: GhcSrc -> !Maybe [ClsInst] -- | Binders created by GHC eg dictionaries [_giDerVars] :: GhcSrc -> !HashSet Var -- | Binders that are _read_ in module (but not defined?) [_giImpVars] :: GhcSrc -> ![Var] -- | (Top-level) binders that are _defined_ in module [_giDefVars] :: GhcSrc -> ![Var] -- | Binders that are _read_ in module [_giUseVars] :: GhcSrc -> ![Var] -- | Names exported by the module being verified [_gsExports] :: GhcSrc -> !HashSet StableName -- | Family instance TyCons [_gsFiTcs] :: GhcSrc -> ![TyCon] -- | Family instance DataCons [_gsFiDcs] :: GhcSrc -> ![(Symbol, DataCon)] -- | Primitive GHC TyCons (from TysPrim.primTyCons) [_gsPrimTcs] :: GhcSrc -> ![TyCon] -- | Map of qualified imports [_gsQualImps] :: GhcSrc -> !QImports -- | Set of _all_ imported modules [_gsAllImps] :: GhcSrc -> !HashSet Symbol -- | All the TyThings known to GHC [_gsTyThings] :: GhcSrc -> ![TyThing] data GhcSpec SP :: !GhcSpecSig -> !GhcSpecQual -> !GhcSpecData -> !GhcSpecNames -> !GhcSpecVars -> !GhcSpecTerm -> !GhcSpecRefl -> !GhcSpecLaws -> ![(Symbol, Sort)] -> !Config -> !Spec LocBareType LocSymbol -> GhcSpec [_gsSig] :: GhcSpec -> !GhcSpecSig [_gsQual] :: GhcSpec -> !GhcSpecQual [_gsData] :: GhcSpec -> !GhcSpecData [_gsName] :: GhcSpec -> !GhcSpecNames [_gsVars] :: GhcSpec -> !GhcSpecVars [_gsTerm] :: GhcSpec -> !GhcSpecTerm [_gsRefl] :: GhcSpec -> !GhcSpecRefl [_gsLaws] :: GhcSpec -> !GhcSpecLaws -- | Imported Environment [_gsImps] :: GhcSpec -> ![(Symbol, Sort)] [_gsConfig] :: GhcSpec -> !Config -- | Lifted specification for the target module [_gsLSpec] :: GhcSpec -> !Spec LocBareType LocSymbol targetSrcIso :: Iso' GhcSrc TargetSrc targetSpecGetter :: Getter GhcSpec (TargetSpec, LiftedSpec) bareSpecIso :: Iso' (Spec LocBareType LocSymbol) BareSpec liftedSpecGetter :: Getter (Spec LocBareType LocSymbol) LiftedSpec unsafeFromLiftedSpec :: LiftedSpec -> Spec LocBareType LocSymbol instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.QImports instance (Language.Fixpoint.Types.PrettyPrint.PPrint ty, Language.Fixpoint.Types.PrettyPrint.PPrint bndr, GHC.Show.Show ty) => GHC.Show.Show (Language.Haskell.Liquid.Types.Specs.Spec ty bndr) instance GHC.Generics.Generic (Language.Haskell.Liquid.Types.Specs.Spec ty bndr) instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Specs.BareSpec instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.BareSpec instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Specs.BareSpec instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.BareSpec instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Specs.BareSpec instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Specs.LiftedSpec instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Specs.LiftedSpec instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.LiftedSpec instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Specs.LiftedSpec instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Specs.LiftedSpec instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Specs.StableModule instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Specs.TargetDependencies instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Specs.TargetDependencies instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.TargetDependencies instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Specs.TargetDependencies instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.TargetDependencies instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Specs.TargetDependencies instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Types.Specs.GhcSpec instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Specs.StableModule instance GHC.Classes.Ord Language.Haskell.Liquid.Types.Specs.StableModule instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Specs.StableModule instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.StableModule instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Specs.StableModule instance Data.Binary.Class.Binary (Language.Haskell.Liquid.Types.Specs.Spec Language.Haskell.Liquid.Types.Types.LocBareType Language.Fixpoint.Types.Names.LocSymbol) instance (GHC.Show.Show ty, GHC.Show.Show bndr, Language.Fixpoint.Types.PrettyPrint.PPrint ty, Language.Fixpoint.Types.PrettyPrint.PPrint bndr) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Specs.Spec ty bndr) instance GHC.Base.Semigroup (Language.Haskell.Liquid.Types.Specs.Spec ty bndr) instance GHC.Base.Monoid (Language.Haskell.Liquid.Types.Specs.Spec ty bndr) instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Types.Specs.TargetInfo instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Types.Specs.TargetSpec module Language.Haskell.Liquid.Measure -- | A generic Spec type, polymorphic over the inner choice of type -- and binder. data Spec ty bndr Spec :: ![Measure ty bndr] -> ![(Symbol, Sort)] -> ![(Symbol, Sort)] -> ![(LocSymbol, ty)] -> ![(LocSymbol, ty)] -> ![(LocSymbol, ty)] -> ![(LocSymbol, ty)] -> ![(Maybe LocSymbol, ty)] -> ![(ty, ty)] -> ![Symbol] -> ![DataDecl] -> ![DataDecl] -> ![FilePath] -> ![Located (RTAlias Symbol BareType)] -> ![Located (RTAlias Symbol Expr)] -> !TCEmb LocSymbol -> ![Qualifier] -> ![(LocSymbol, [Int])] -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashMap LocSymbol [LocSymbol] -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashMap LocSymbol (Maybe Int) -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> !HashSet LocSymbol -> ![Located String] -> ![Measure ty ()] -> ![Measure ty bndr] -> ![RClass ty] -> ![RClass ty] -> ![(LocSymbol, [Located Expr])] -> ![RInstance ty] -> ![RILaws ty] -> ![(LocSymbol, [Variance])] -> !RRBEnv ty -> !HashMap LocSymbol Symbol -> ![Equation] -> Spec ty bndr -- | User-defined properties for ADTs [measures] :: Spec ty bndr -> ![Measure ty bndr] -- | Imported variables types [impSigs] :: Spec ty bndr -> ![(Symbol, Sort)] -- | Exported variables types [expSigs] :: Spec ty bndr -> ![(Symbol, Sort)] -- | Assumed (unchecked) types; including reflected signatures [asmSigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Imported functions and types [sigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Local type signatures [localSigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Reflected type signatures [reflSigs] :: Spec ty bndr -> ![(LocSymbol, ty)] -- | Data type invariants; the Maybe is the generating measure [invariants] :: Spec ty bndr -> ![(Maybe LocSymbol, ty)] -- | Data type invariants to be checked [ialiases] :: Spec ty bndr -> ![(ty, ty)] -- | Loaded spec module names [imports] :: Spec ty bndr -> ![Symbol] -- | Predicated data definitions [dataDecls] :: Spec ty bndr -> ![DataDecl] -- | Predicated new type definitions [newtyDecls] :: Spec ty bndr -> ![DataDecl] -- | Included qualifier files [includes] :: Spec ty bndr -> ![FilePath] -- | RefType aliases [aliases] :: Spec ty bndr -> ![Located (RTAlias Symbol BareType)] -- | Expression aliases [ealiases] :: Spec ty bndr -> ![Located (RTAlias Symbol Expr)] -- | GHC-Tycon-to-fixpoint Tycon map [embeds] :: Spec ty bndr -> !TCEmb LocSymbol -- | Qualifiers in source/spec files [qualifiers] :: Spec ty bndr -> ![Qualifier] -- | Information on decreasing arguments [decr] :: Spec ty bndr -> ![(LocSymbol, [Int])] -- | Variables that should be checked in the environment they are used [lvars] :: Spec ty bndr -> !HashSet LocSymbol -- | Ignore Termination Check in these Functions [lazy] :: Spec ty bndr -> !HashSet LocSymbol -- | Theorems turned into rewrite rules [rewrites] :: Spec ty bndr -> !HashSet LocSymbol -- | Definitions using rewrite rules [rewriteWith] :: Spec ty bndr -> !HashMap LocSymbol [LocSymbol] -- | These Functions should be unsafe [fails] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to reflect [reflects] :: Spec ty bndr -> !HashSet LocSymbol -- | Automatically instantiate axioms in these Functions with maybe -- specified fuel [autois] :: Spec ty bndr -> !HashMap LocSymbol (Maybe Int) -- | Binders to turn into measures using haskell definitions [hmeas] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to turn into bounds using haskell definitions [hbounds] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to turn into logic inline using haskell definitions [inlines] :: Spec ty bndr -> !HashSet LocSymbol -- | Binders to ignore during checking; that is DON't check the corebind. [ignores] :: Spec ty bndr -> !HashSet LocSymbol -- | Type Constructors that get automatically sizing info [autosize] :: Spec ty bndr -> !HashSet LocSymbol -- | Command-line configurations passed in through source [pragmas] :: Spec ty bndr -> ![Located String] -- | Measures attached to a type-class [cmeasures] :: Spec ty bndr -> ![Measure ty ()] -- | Mappings from (measure,type) -> measure [imeasures] :: Spec ty bndr -> ![Measure ty bndr] -- | Refined Type-Classes [classes] :: Spec ty bndr -> ![RClass ty] -- | Refined Type-Classe Laws [claws] :: Spec ty bndr -> ![RClass ty] -- | Terminating Conditions for functions [termexprs] :: Spec ty bndr -> ![(LocSymbol, [Located Expr])] [rinstance] :: Spec ty bndr -> ![RInstance ty] [ilaws] :: Spec ty bndr -> ![RILaws ty] -- | ? Where do these come from ?! [dvariance] :: Spec ty bndr -> ![(LocSymbol, [Variance])] [bounds] :: Spec ty bndr -> !RRBEnv ty -- | Temporary (?) hack to deal with dictionaries in specifications see -- testsposNatClass.hs [defs] :: Spec ty bndr -> !HashMap LocSymbol Symbol -- | Equalities used for Proof-By-Evaluation [axeqs] :: Spec ty bndr -> ![Equation] data MSpec ty ctor MSpec :: HashMap Symbol [Def ty ctor] -> HashMap LocSymbol (Measure ty ctor) -> HashMap LocSymbol (Measure ty ()) -> ![Measure ty ctor] -> MSpec ty ctor [ctorMap] :: MSpec ty ctor -> HashMap Symbol [Def ty ctor] [measMap] :: MSpec ty ctor -> HashMap LocSymbol (Measure ty ctor) [cmeasMap] :: MSpec ty ctor -> HashMap LocSymbol (Measure ty ()) [imeas] :: MSpec ty ctor -> ![Measure ty ctor] type BareSpec = Spec LocBareType LocSymbol type BareMeasure = Measure LocBareType LocSymbol type SpecMeasure = Measure LocSpecType DataCon mkM :: LocSymbol -> ty -> [Def ty bndr] -> MeasureKind -> UnSortedExprs -> Measure ty bndr mkMSpec :: [Measure t LocSymbol] -> [Measure t ()] -> [Measure t LocSymbol] -> MSpec t LocSymbol mkMSpec' :: Symbolic ctor => [Measure ty ctor] -> MSpec ty ctor dataConTypes :: MSpec (RRType Reft) DataCon -> ([(Var, RRType Reft)], [(LocSymbol, RRType Reft)]) defRefType :: Type -> Def (RRType Reft) DataCon -> RRType Reft bodyPred :: Expr -> Body -> Expr -- | This module has the code that uses the GHC definitions to: 1. MAKE a -- name-resolution environment, 2. USE the environment to translate plain -- symbols into Var, TyCon, etc. module Language.Haskell.Liquid.Bare.Types -- | Name resolution environment data Env RE :: !LogicMap -> ![(Symbol, Var)] -> !Subst -> !TyThingMap -> !Config -> !QImports -> !HashSet Symbol -> !LocalVars -> !HashSet Symbol -> !GhcSrc -> Env [reLMap] :: Env -> !LogicMap -- | see "syms" in old makeGhcSpec' [reSyms] :: Env -> ![(Symbol, Var)] -- | see "su" in old makeGhcSpec' [_reSubst] :: Env -> !Subst [_reTyThings] :: Env -> !TyThingMap [reCfg] :: Env -> !Config -- | qualified imports [reQualImps] :: Env -> !QImports -- | all imported modules [reAllImps] :: Env -> !HashSet Symbol -- | lines at which local variables are defined. [reLocalVars] :: Env -> !LocalVars -- | global symbols, typically unlifted measures like len, -- fromJust [reGlobSyms] :: Env -> !HashSet Symbol -- | all source info [reSrc] :: Env -> !GhcSrc -- | A TyThingMap is used to resolve symbols into GHC -- TyThing and, from there into Var, TyCon, DataCon, etc. type TyThingMap = HashMap Symbol [(Symbol, TyThing)] type ModSpecs = HashMap ModName BareSpec -- | LocalVars is a map from names to lists of pairs of -- Ghc.Var and the lines at which they were defined. type LocalVars = HashMap Symbol [(Int, Var)] -- | A TycEnv contains the information needed to process Type- and -- Data- Constructors data TycEnv TycEnv :: ![TyConP] -> ![DataConP] -> ![Measure SpecType DataCon] -> ![(Var, LocSpecType)] -> !TyConMap -> ![DataDecl] -> !DataConMap -> !TCEmb TyCon -> !ModName -> TycEnv [tcTyCons] :: TycEnv -> ![TyConP] [tcDataCons] :: TycEnv -> ![DataConP] [tcSelMeasures] :: TycEnv -> ![Measure SpecType DataCon] [tcSelVars] :: TycEnv -> ![(Var, LocSpecType)] [tcTyConMap] :: TycEnv -> !TyConMap [tcAdts] :: TycEnv -> ![DataDecl] [tcDataConMap] :: TycEnv -> !DataConMap [tcEmbs] :: TycEnv -> !TCEmb TyCon [tcName] :: TycEnv -> !ModName type DataConMap = HashMap (Symbol, Int) Symbol -- | Information about Type Constructors data TyConMap -- | A SigEnv contains the needed to process type signatures data SigEnv SigEnv :: !TCEmb TyCon -> !TyConMap -> !HashSet StableName -> !BareRTEnv -> SigEnv [sigEmbs] :: SigEnv -> !TCEmb TyCon [sigTyRTyMap] :: SigEnv -> !TyConMap [sigExports] :: SigEnv -> !HashSet StableName [sigRTEnv] :: SigEnv -> !BareRTEnv -- | Intermediate representation for Measure information data MeasEnv MeasEnv :: !MSpec SpecType DataCon -> ![(Symbol, Located (RRType Reft))] -> ![(Symbol, Located (RRType Reft))] -> ![(Var, LocSpecType)] -> ![DataConP] -> ![(ModName, Var, LocSpecType)] -> ![(Class, [(ModName, Var, LocSpecType)])] -> MeasEnv [meMeasureSpec] :: MeasEnv -> !MSpec SpecType DataCon [meClassSyms] :: MeasEnv -> ![(Symbol, Located (RRType Reft))] [meSyms] :: MeasEnv -> ![(Symbol, Located (RRType Reft))] [meDataCons] :: MeasEnv -> ![(Var, LocSpecType)] [meClasses] :: MeasEnv -> ![DataConP] [meMethods] :: MeasEnv -> ![(ModName, Var, LocSpecType)] [meCLaws] :: MeasEnv -> ![(Class, [(ModName, Var, LocSpecType)])] -- | See [NOTE: Plug-Holes-TyVars] for a rationale for PlugTV data PlugTV v -- | Use tyvars from GHC specification (in the v) HsTV :: v -> PlugTV v -- | Use tyvars from Liquid specification LqTV :: v -> PlugTV v -- | Generalize ty-vars GenTV :: PlugTV v -- | Do NOT generalize ty-vars (e.g. for type-aliases) RawTV :: PlugTV v plugSrc :: PlugTV v -> Maybe v varRSort :: Var -> RSort -- | Converting Var to Sort varSortedReft :: TCEmb TyCon -> Var -> SortedReft -- | Handling failed resolution failMaybe :: Env -> ModName -> Either UserError r -> Maybe r instance GHC.Show.Show v => GHC.Show.Show (Language.Haskell.Liquid.Bare.Types.PlugTV v) instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Bare.Types.Env instance (GHC.Show.Show v, Language.Fixpoint.Types.PrettyPrint.PPrint v) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Bare.Types.PlugTV v) -- | This module contains functions for recursively "rewriting" GHC core -- using "rules". module Language.Haskell.Liquid.Transforms.Rewrite -- | Top-level rewriter -- -------------------------------------------------------- rewriteBinds :: Config -> [CoreBind] -> [CoreBind] module Language.Haskell.Liquid.Transforms.Rec transformRecExpr :: CoreProgram -> CoreProgram transformScope :: [Bind Id] -> [Bind Id] outerScTr :: [Bind Id] -> [Bind Id] innerScTr :: Functor f => f (Bind Id) -> f (Bind Id) isIdTRecBound :: Id -> Bool setIdTRecBound :: Id -> Id instance Language.Haskell.Liquid.Transforms.Rec.Freshable GHC.Types.Int instance Language.Haskell.Liquid.Transforms.Rec.Freshable Unique.Unique instance Language.Haskell.Liquid.Transforms.Rec.Freshable Var.Var -- | Convert GHC Core into Administrative Normal Form (ANF) -- -------------------- module Language.Haskell.Liquid.Transforms.ANF -- | A-Normalize a module -- ------------------------------------------------------ anormalize :: Config -> HscEnv -> ModGuts -> IO [CoreBind] instance GHC.Base.Applicative Language.Haskell.Liquid.Transforms.ANF.DsM instance UniqSupply.MonadUnique Language.Haskell.Liquid.Transforms.ANF.DsM instance GHC.Base.Monad Language.Haskell.Liquid.Transforms.ANF.DsM instance GHC.Base.Functor Language.Haskell.Liquid.Transforms.ANF.DsM instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Transforms.ANF.AnfEnv module Language.Haskell.Liquid.Bare.Misc freeSymbols :: (Reftable r, Reftable r1, Reftable r2, TyConable c, TyConable c1, TyConable c2) => [Symbol] -> [(a1, Located (RType c2 tv2 r2))] -> [(a, Located (RType c1 tv1 r1))] -> [Located (RType c tv r)] -> [LocSymbol] joinVar :: [Var] -> (Var, s, t) -> (Var, s, t) mkVarExpr :: Id -> Expr vmap :: MapTyVarST -> [(Var, RTyVar)] runMapTyVars :: Type -> SpecType -> (Doc -> Doc -> Error) -> Either Error MapTyVarST matchKindArgs :: [SpecType] -> [SpecType] -> [SpecType] symbolRTyVar :: Symbol -> RTyVar simpleSymbolVar :: Var -> Symbol hasBoolResult :: Type -> Bool isKind :: Kind -> Bool module Gradual.PrettyPrinting class Pretty a pretty :: Pretty a => a -> String simplifyExpr :: Expr -> Expr instance Gradual.PrettyPrinting.Pretty Language.Fixpoint.Types.Refinements.Expr instance Gradual.PrettyPrinting.Pretty Language.Fixpoint.Types.Refinements.KVar instance Gradual.PrettyPrinting.Pretty Language.Fixpoint.Types.Names.Symbol instance (Gradual.PrettyPrinting.Pretty a, Gradual.PrettyPrinting.Pretty b) => Gradual.PrettyPrinting.Pretty (a, b) instance Gradual.PrettyPrinting.Pretty a => Gradual.PrettyPrinting.Pretty [a] module Gradual.GUI.Types data Unique Unique :: Int -> SrcSpan -> Symbol -> Unique [uId] :: Unique -> Int [uLoc] :: Unique -> SrcSpan [uName] :: Unique -> Symbol type LocTokens = [(TokenType, String, Loc)] type Deps = Dependencies () type SDeps = Dependencies String type Dependencies val = [(Unique, [(Unique, val)])] type PKeys = [[KVar]] makePKeys :: [[GSub a]] -> PKeys kVarId :: Dependencies v -> KVar -> (Int, Int) srcDeps :: Dependencies v -> [(Int, Int, SrcSpan, v)] gSpanToDeps :: GSub a -> GSpan -> SDeps kVarSpan :: Symbol -> SrcSpan takeFileName :: String -> String symbolLoc :: Symbol -> Loc instance GHC.Show.Show Gradual.GUI.Types.Unique module Gradual.GUI.Annotate renderHtml :: FilePath -> String -> LocTokens -> SDeps -> String -- | This module has the code that uses the GHC definitions to: 1. MAKE a -- name-resolution environment, 2. USE the environment to translate plain -- symbols into Var, TyCon, etc. module Language.Haskell.Liquid.Bare.Resolve -- | Creating an environment makeEnv :: Config -> GhcSrc -> LogicMap -> [(ModName, BareSpec)] -> Env -- | Using the environment class ResolveSym a resolveLocSym :: ResolveSym a => Env -> ModName -> String -> LocSymbol -> Either UserError a class Qualify a qualify :: Qualify a => Env -> ModName -> SourcePos -> [Symbol] -> a -> a -- | Qualify various names qualifyTop :: Qualify a => Env -> ModName -> SourcePos -> a -> a qualifyTopDummy :: Qualify a => Env -> ModName -> a -> a -- | maybeResolve wraps the plain resolve to return -- Nothing if the name being searched for is unknown. maybeResolveSym :: ResolveSym a => Env -> ModName -> String -> LocSymbol -> Maybe a lookupGhcDataCon :: Env -> ModName -> String -> LocSymbol -> DataCon lookupGhcDnTyCon :: Env -> ModName -> String -> DataName -> Maybe TyCon lookupGhcTyCon :: Env -> ModName -> String -> LocSymbol -> TyCon lookupGhcVar :: Env -> ModName -> String -> LocSymbol -> Var lookupGhcNamedVar :: (NamedThing a, Symbolic a) => Env -> ModName -> a -> Maybe Var knownGhcVar :: Env -> ModName -> LocSymbol -> Bool knownGhcTyCon :: Env -> ModName -> LocSymbol -> Bool knownGhcDataCon :: Env -> ModName -> LocSymbol -> Bool -- | Checking existence of names knownGhcType :: Env -> ModName -> LocBareType -> Bool -- | We prioritize the Ghc.Var in srcVars because -- _giDefVars and gsTyThings have _different_ values -- for the same binder, with different types where the type params are -- alpha-renamed. However, for absref, we need _the same_ type parameters -- as used by GHC as those are used inside the lambdas and other bindings -- in the code. See also [NOTE: Plug-Holes-TyVars] and -- tests-absref-pos-Papp00.hs srcVars :: GhcSrc -> [Var] ofBareTypeE :: Env -> ModName -> SourcePos -> Maybe [PVar BSort] -> BareType -> Either UserError SpecType -- | ofBareType and ofBareTypeE should be the _only_ -- SpecType constructors ofBareType :: Env -> ModName -> SourcePos -> Maybe [PVar BSort] -> BareType -> SpecType ofBPVar :: Env -> ModName -> SourcePos -> BPVar -> RPVar -- | Is this the SAME as addTyConInfo? No. txRefSort (1) adds the -- _real_ sorts to RProp, (2) gathers _extra_ RProp at turns them into -- refinements, e.g. testsposmulti-pred-app-00.hs txRefSort :: TyConMap -> TCEmb TyCon -> LocSpecType -> LocSpecType errResolve :: Doc -> String -> LocSymbol -> UserError -- | resolveLocalBinds resolves that the "free" variables that -- appear in the type-sigs for non-toplevel binders (that correspond to -- other locally bound) source variables that are visible at that at -- non-top-level scope. e.g. tests-names-pos-local02.hs resolveLocalBinds :: Env -> [(Var, LocBareType, Maybe [Located Expr])] -> [(Var, LocBareType, Maybe [Located Expr])] partitionLocalBinds :: [(Var, a)] -> ([(Var, a)], [(Var, a)]) instance Language.Haskell.Liquid.Bare.Resolve.ResolveSym Var.Var instance Language.Haskell.Liquid.Bare.Resolve.ResolveSym TyCon.TyCon instance Language.Haskell.Liquid.Bare.Resolve.ResolveSym DataCon.DataCon instance Language.Haskell.Liquid.Bare.Resolve.ResolveSym Language.Fixpoint.Types.Names.Symbol instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.TyConMap instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.TyConP instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.SizeFun instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Fixpoint.Types.Constraints.Equation instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Fixpoint.Types.Names.Symbol instance Language.Haskell.Liquid.Bare.Resolve.Qualify a => Language.Haskell.Liquid.Bare.Resolve.Qualify (Language.Fixpoint.Types.Spans.Located a) instance Language.Haskell.Liquid.Bare.Resolve.Qualify a => Language.Haskell.Liquid.Bare.Resolve.Qualify [a] instance Language.Haskell.Liquid.Bare.Resolve.Qualify a => Language.Haskell.Liquid.Bare.Resolve.Qualify (GHC.Maybe.Maybe a) instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.Body instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.TyConInfo instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.RTyCon instance Language.Haskell.Liquid.Bare.Resolve.Qualify (Language.Haskell.Liquid.Types.Types.Measure Language.Haskell.Liquid.Types.Types.SpecType DataCon.DataCon) instance Language.Haskell.Liquid.Bare.Resolve.Qualify (Language.Haskell.Liquid.Types.Types.Def ty ctor) instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Specs.BareMeasure instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.DataCtor instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.DataDecl instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Bare.Types.ModSpecs instance Language.Haskell.Liquid.Bare.Resolve.Qualify b => Language.Haskell.Liquid.Bare.Resolve.Qualify (a, b) instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Measure.BareSpec instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Fixpoint.Types.Refinements.Expr instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.RReft instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Fixpoint.Types.Constraints.Qualifier instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.SpecType instance Language.Haskell.Liquid.Bare.Resolve.Qualify Language.Haskell.Liquid.Types.Types.BareType module Language.Haskell.Liquid.Bare.DataType -- | DataConMap stores the names of those ctor-fields that have -- been declared as SMT ADTs so we don't make up new names for them. dataConMap :: [DataDecl] -> DataConMap -- | 'makeDataConChecker d' creates the measure for `is$d` which tests -- whether a given value was created by d. e.g. is$Nil or -- is$Cons. makeDataConChecker :: DataCon -> Symbol -- | 'makeDataConSelector d' creates the selector `select$d$i` which -- projects the i-th field of a constructed value. e.g. `select$Cons$1` -- and `select$Cons$2` are respectively equivalent to head and -- tail. makeDataConSelector :: Maybe DataConMap -> DataCon -> Int -> Symbol -- | makeClassEmbeds: sort-embeddings for numeric, and family-instance -- tycons addClassEmbeds :: Maybe [ClsInst] -> [TyCon] -> TCEmb TyCon -> TCEmb TyCon makeDataDecls :: Config -> TCEmb TyCon -> ModName -> [(ModName, TyCon, DataPropDecl)] -> [Located DataConP] -> [DataDecl] -- | Bare Predicate: DataCon Definitions -- --------------------------------------- makeConTypes :: Env -> (ModName, BareSpec) -> ([(ModName, TyConP, Maybe DataPropDecl)], [[Located DataConP]]) makeRecordSelectorSigs :: Env -> ModName -> [Located DataConP] -> [(Var, LocSpecType)] meetDataConSpec :: TCEmb TyCon -> [(Var, SpecType)] -> [DataConP] -> [(Var, SpecType)] module Language.Haskell.Liquid.Transforms.CoreToLogic coreToDef :: Reftable r => LocSymbol -> Var -> CoreExpr -> LogicM [Def (Located (RRType r)) DataCon] coreToFun :: LocSymbol -> Var -> CoreExpr -> LogicM ([Var], Either Expr Expr) coreToLogic :: CoreExpr -> LogicM Expr mkLit :: Literal -> Maybe Expr mkI :: Integer -> Maybe Expr mkS :: ByteString -> Maybe Expr runToLogic :: TCEmb TyCon -> LogicMap -> DataConMap -> (String -> Error) -> LogicM t -> Either Error t runToLogicWithBoolBinds :: [Var] -> TCEmb TyCon -> LogicMap -> DataConMap -> (String -> Error) -> LogicM t -> Either Error t logicType :: Reftable r => Type -> RRType r -- | inlineSpecType :: Var -> SpecType -- | Refine types of measures: keep going until you find the last data con! -- this code is a hack! we refine the last data constructor, it got -- complicated to support both 1. multi parameter measures (see -- testsposHasElem.hs) 2. measures returning functions (fromReader -- :: Reader r a -> (r -> a) ) TODO: SIMPLIFY by dropping support -- for multi parameter measures measureSpecType :: Var -> SpecType -- | 'weakenResult foo t' drops the singleton constraint `v = foo x y` that -- is added, e.g. for measures in /strengthenResult'. This should only be -- used _when_ checking the body of foo where the output, is, by -- definition, equal to the singleton. weakenResult :: Var -> SpecType -> SpecType normalize :: Simplify a => a -> a instance Language.Haskell.Liquid.Transforms.CoreToLogic.Simplify CoreSyn.CoreExpr instance Language.Haskell.Liquid.Transforms.CoreToLogic.Simplify CoreSyn.CoreBind instance Language.Haskell.Liquid.Transforms.CoreToLogic.Simplify CoreSyn.CoreAlt instance GHC.Show.Show CoreSyn.CoreExpr module Language.Haskell.Liquid.Types.Literals literalFRefType :: Literal -> RType RTyCon RTyVar Reft literalFReft :: Literal -> Reft -- | literalConst returns Nothing for unhandled lits because -- otherwise string-literals show up as global int-constants which blow -- up qualifier instantiation. literalConst :: TCEmb TyCon -> Literal -> (Sort, Maybe Expr) mkI :: Integer -> Maybe Expr mkS :: ByteString -> Maybe Expr -- | This module re-exports a bunch of the Types modules module Language.Haskell.Liquid.Types -- | This module contains the code for Incremental checking, which finds -- the part of a target file (the subset of the [CoreBind] that -- have been modified since it was last checked, as determined by a diff -- against a saved version of the file. module Language.Haskell.Liquid.UX.DiffCheck -- | Data Types -- ---------------------------------------------------------------- -- -- Main type of value returned for diff-check. data DiffCheck DC :: [CoreBind] -> !Output Doc -> !TargetSpec -> DiffCheck [newBinds] :: DiffCheck -> [CoreBind] [oldOutput] :: DiffCheck -> !Output Doc [newSpec] :: DiffCheck -> !TargetSpec -- | slice returns a subset of the [CoreBind] of the input -- target file which correspond to top-level binders whose code -- has changed and their transitive dependencies. slice :: FilePath -> [CoreBind] -> TargetSpec -> IO (Maybe DiffCheck) -- | thin cbs sp vs returns a subset of the cbs :: -- [CoreBind] which correspond to the definitions of vs and -- the functions transitively called therein for which there are *no* -- type signatures. Callees with type signatures are assumed to satisfy -- those signatures. thin :: [CoreBind] -> TargetSpec -> [Var] -> DiffCheck -- | save creates an .saved version of the target file, -- which will be used to find what has changed the next time -- target is checked. saveResult :: FilePath -> Output Doc -> IO () -- | checkedNames returns the names of the top-level binders that -- will be checked checkedVars :: DiffCheck -> [Var] filterBinds :: [CoreBind] -> HashSet Var -> [CoreBind] coreDeps :: [CoreBind] -> Deps -- | Given a call graph, and a list of vars, dependsOn checks all -- functions to see if they call any of the functions in the vars list. -- If any do, then they must also be rechecked. dependsOn :: Deps -> [Var] -> HashSet Var instance GHC.Classes.Ord Language.Haskell.Liquid.UX.DiffCheck.Def instance GHC.Classes.Eq Language.Haskell.Liquid.UX.DiffCheck.Def instance GHC.Show.Show Language.Haskell.Liquid.UX.DiffCheck.Def instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.UX.DiffCheck.DiffCheck instance GHC.Base.Functor Data.Algorithm.Diff.Diff instance Data.Aeson.Types.ToJSON.ToJSON Text.Parsec.Pos.SourcePos instance Data.Aeson.Types.FromJSON.FromJSON Text.Parsec.Pos.SourcePos instance Data.Aeson.Types.ToJSON.ToJSON Language.Fixpoint.Solver.Stats.Stats instance Data.Aeson.Types.FromJSON.FromJSON Language.Fixpoint.Solver.Stats.Stats instance Data.Aeson.Types.ToJSON.ToJSON Language.Haskell.Liquid.Types.Types.ErrorResult instance Data.Aeson.Types.FromJSON.FromJSON Language.Haskell.Liquid.Types.Types.ErrorResult instance Data.Aeson.Types.ToJSON.ToJSON Text.PrettyPrint.HughesPJ.Doc instance Data.Aeson.Types.FromJSON.FromJSON Text.PrettyPrint.HughesPJ.Doc instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.Haskell.Liquid.Types.Types.AnnInfo a) instance Data.Aeson.Types.ToJSON.ToJSON (Language.Haskell.Liquid.Types.Types.Output Text.PrettyPrint.HughesPJ.Doc) instance Data.Aeson.Types.FromJSON.FromJSON (Language.Haskell.Liquid.Types.Types.Output Text.PrettyPrint.HughesPJ.Doc) -- | This module contains the code that uses the inferred types to generate -- 1. HTMLized source with Inferred Types in mouseover annotations. 2. -- Annotations files (e.g. for vim/emacs) 3. JSON files for the web-demo -- etc. module Language.Haskell.Liquid.UX.Annotate -- | output creates the pretty printed output mkOutput :: Config -> ErrorResult -> FixSolution -> AnnInfo (Annot SpecType) -> Output Doc -- | annotate actually renders the output to files annotate :: Config -> [FilePath] -> Output Doc -> IO AnnMap tokeniseWithLoc :: String -> [(TokenType, String, Loc)] annErrors :: AnnMap -> AnnErrors instance Data.Aeson.Types.ToJSON.ToJSON Language.Haskell.Liquid.UX.Annotate.Annot1 instance Data.Aeson.Types.ToJSON.ToJSON Language.Haskell.Liquid.UX.Annotate.AnnErrors instance (GHC.Show.Show k, Data.Aeson.Types.ToJSON.ToJSON a) => Data.Aeson.Types.ToJSON.ToJSON (Language.Haskell.Liquid.UX.Annotate.Assoc k a) instance Data.Aeson.Types.ToJSON.ToJSON Language.Haskell.Liquid.UX.ACSS.Status instance Data.Aeson.Types.ToJSON.ToJSON Language.Haskell.Liquid.GHC.Misc.Loc instance Data.Aeson.Types.ToJSON.ToJSON Language.Haskell.Liquid.UX.ACSS.AnnMap -- | This module contains all the code needed to output the result which is -- either: SAFE or WARNING with some reasonable error -- message when something goes wrong. All forms of errors/exceptions -- should go through here. The idea should be to report the error, the -- source position that causes it, generate a suitable .json file and -- then exit. module Language.Haskell.Liquid.UX.CmdLine getOpts :: [String] -> IO Config mkOpts :: Config -> IO Config defConfig :: Config config :: Mode (CmdArgs Config) withPragmas :: Config -> FilePath -> [Located String] -> IO Config -- | Attempt to canonicalize all FilePaths in the Config so -- we don't have to worry about relative paths. canonicalizePaths :: FilePath -> Config -> IO Config exitWithResult :: Config -> [FilePath] -> Output Doc -> IO () addErrors :: FixResult a -> [a] -> FixResult a data OutputResult OutputResult :: Doc -> [(SrcSpan, Doc)] -> OutputResult -- | The "header" like "LIQUID: SAFE", or "LIQUID: UNSAFE". [orHeader] :: OutputResult -> Doc -- | The list of pretty-printable messages (typically errors) together with -- their source locations. [orMessages] :: OutputResult -> [(SrcSpan, Doc)] -- | Writes the annotations (i.e. the files in the ".liquid" hidden folder) -- and report the result of the checking using a supplied function. reportResult :: MonadIO m => (OutputResult -> m ()) -> Config -> [FilePath] -> Output Doc -> m () -- | check subset of binders modified (+ dependencies) since last check diffcheck :: Config -> Bool -- | Shows the LiquidHaskell banner, that includes things like the -- copyright, the git commit and the version. printLiquidHaskellBanner :: IO () instance Language.Fixpoint.Types.PrettyPrint.Fixpoint (Language.Fixpoint.Types.Errors.FixResult Language.Haskell.Liquid.UX.CmdLine.CError) instance GHC.Show.Show (Language.Haskell.Liquid.Types.Errors.CtxError Text.PrettyPrint.HughesPJ.Doc) module Gradual.GUI render :: GConfig -> GSpan -> [[GSub a]] -> IO () module Language.Haskell.Liquid.Types.Equality compareRType :: SpecType -> SpecType -> Bool class REq a (=*=) :: REq a => a -> a -> Bool instance Language.Haskell.Liquid.Types.Equality.REq Language.Haskell.Liquid.Types.Types.SpecType instance Language.Haskell.Liquid.Types.Equality.REq t2 => Language.Haskell.Liquid.Types.Equality.REq (Language.Haskell.Liquid.Types.Types.Ref t1 t2) instance Language.Haskell.Liquid.Types.Equality.REq (Language.Haskell.Liquid.Types.Types.UReft Language.Fixpoint.Types.Refinements.Reft) instance Language.Haskell.Liquid.Types.Equality.REq Language.Fixpoint.Types.Refinements.Reft instance Language.Haskell.Liquid.Types.Equality.REq Language.Fixpoint.Types.Refinements.Expr instance Language.Haskell.Liquid.Types.Equality.REq r => Language.Haskell.Liquid.Types.Equality.REq (Language.Fixpoint.Types.Spans.Located r) module Language.Haskell.Liquid.Transforms.Simplify simplifyBounds :: SpecType -> SpecType -- | This module contains the functions related to Error type, in -- particular, to tidyError using a solution, and -- pprint errors. module Language.Haskell.Liquid.UX.Errors tidyError :: Config -> FixSolution -> Error -> Error module Language.Haskell.Liquid.Transforms.RefSplit splitXRelatedRefs :: Symbol -> SpecType -> (SpecType, SpecType) instance Language.Fixpoint.Types.Refinements.Subable x => Language.Haskell.Liquid.Transforms.RefSplit.IsFree x instance GHC.Show.Show (Language.Haskell.Liquid.Types.Types.UReft Language.Fixpoint.Types.Refinements.Reft) module Language.Haskell.Liquid.Termination.Structural terminationVars :: TargetInfo -> [Var] instance GHC.Show.Show Language.Haskell.Liquid.Termination.Structural.TermError instance GHC.Show.Show a => GHC.Show.Show (Language.Haskell.Liquid.Termination.Structural.Result a) instance GHC.Classes.Eq Language.Haskell.Liquid.Termination.Structural.Param instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Language.Haskell.Liquid.Termination.Structural.FunInfo a) instance GHC.Base.Semigroup a => GHC.Base.Monoid (Language.Haskell.Liquid.Termination.Structural.FunInfo a) instance GHC.Base.Functor Language.Haskell.Liquid.Termination.Structural.FunInfo instance Data.Foldable.Foldable Language.Haskell.Liquid.Termination.Structural.FunInfo instance GHC.Base.Monoid a => GHC.Base.Monoid (Language.Haskell.Liquid.Termination.Structural.Result a) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Language.Haskell.Liquid.Termination.Structural.Result a) instance GHC.Base.Monad Language.Haskell.Liquid.Termination.Structural.Result instance GHC.Base.Applicative Language.Haskell.Liquid.Termination.Structural.Result instance GHC.Base.Functor Language.Haskell.Liquid.Termination.Structural.Result module Language.Haskell.Liquid.Synthesize.Termination decrType :: Var -> SpecType -> [Var] -> [(Symbol, SpecType)] -> SpecType module Language.Haskell.Liquid.Synthesize.GHC mkVar :: Maybe String -> Int -> Type -> Var freshName :: Int -> String -- | Assuming that the functions are instantiated when this function is -- called. goalType :: Type -> Type -> Bool createSubgoals :: Type -> [Type] subgoals :: Type -> Maybe (Type, [Type]) withSubgoal :: [(Type, CoreExpr, Int)] -> Type -> [(CoreExpr, Int)] -- | Assuming that goals are type variables or constructors. Note: We -- maintain ordering from the goal type. Not handled (compared to -- @varsInType): function types, type applications unifyWith :: Type -> [Type] fromAnf :: CoreExpr -> CoreExpr -- | Replace let bindings in applications. > If you find a binding add -- it to the second argument. | (lhs, rhs) | fromAnf' :: CoreExpr -> [(Var, CoreExpr)] -> (CoreExpr, [(Var, CoreExpr)]) -- | Function used for pretty printing core as Haskell source. Input does -- not contain let bindings. coreToHs :: SpecType -> Var -> CoreExpr -> String symbols :: String pprintSymbols :: String -> String pprintSym :: String -> Char -> String discardModName :: Var -> String rmModName :: String -> String maintainLParen :: [String] -> String maintainRParen :: [String] -> String pprintFormals :: Int -> Var -> CoreExpr -> Int -> [Var] -> String caseIndent :: Int indent :: Int -> String errorExprPp :: CoreExpr -> Bool pprintVar :: Var -> String pprintBody :: [Var] -> Int -> CoreExpr -> String fixApplication :: String -> String handleCommas :: [String] -> [String] fixCommas :: [String] -> [String] fixParen :: [String] -> [String] rmTypeAppl :: [String] -> [String] paren :: String -> String replaceNewLine :: String -> String pprintAlts :: [Var] -> Int -> Alt Var -> String countTcConstraints :: SpecType -> Int nonTrivial :: CoreExpr -> Bool nonTrivials :: [CoreExpr] -> Bool trivial :: CoreExpr -> Bool hasTrivial :: [CoreExpr] -> Bool allTrivial :: [[CoreExpr]] -> Bool rmTrivials :: [(CoreExpr, Int)] -> [(CoreExpr, Int)] isVar :: CoreExpr -> Bool returnsTuple :: Var -> Bool type SSEnv = HashMap Symbol (SpecType, Var) filterREnv :: HashMap Symbol SpecType -> HashMap Symbol SpecType getTopLvlBndrs :: CoreProgram -> [Var] -- | That' s a hack to get the type variables we need for instantiation. getUniVars :: CoreProgram -> Var -> ([Var], [Var]) getUniVars0 :: CoreExpr -> ([Var], [Var]) -> ([Var], [Var]) getBody :: CoreBind -> Var -> CoreExpr varsP :: CoreProgram -> Var -> (CoreExpr -> [Var]) -> [Var] isInCB :: CoreBind -> Var -> Bool varsCB :: CoreBind -> (CoreExpr -> [Var]) -> [Var] varsE :: CoreExpr -> [Var] caseVarsE :: CoreExpr -> [Var] symbolToVar :: CoreProgram -> Var -> HashMap Symbol SpecType -> SSEnv argsP :: CoreProgram -> Var -> [Var] argsCB :: CoreBind -> [Var] argsE :: CoreExpr -> [Var] notrace :: String -> a -> a instance Data.Default.Class.Default TyCoRep.Type instance Data.Default.Class.Default Var.Var module Language.Haskell.Liquid.Synthesize.Misc isFunction :: Type -> Bool (<$$>) :: (Functor m, Functor n) => (a -> b) -> m (n a) -> m (n b) filterElseM :: Monad m => (a -> m Bool) -> [a] -> m [a] -> m [a] substInFExpr :: Symbol -> Symbol -> Expr -> Expr findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a) composeM :: Monad m => (a -> m b) -> (b -> c) -> a -> m c solDelim :: String pprintMany :: [String] -> Doc showGoals :: [[String]] -> String showEmem :: (Show a1, Show a2) => [(Type, a1, a2)] -> String showEmem' :: (Show a1, Show a2) => [(Type, a1, a2)] -> [(String, String, String)] exprmemToExpr :: [(a2, CoreExpr, Int)] -> String showCand :: (a, (Type, b)) -> (String, b) showCands :: [(a, (Type, b))] -> [(String, b)] notrace :: String -> a -> a showCoreAlt :: CoreAlt -> String showCoreAlts :: [CoreAlt] -> String instance Language.Fixpoint.Types.PrettyPrint.PPrint CoreSyn.AltCon module Language.Haskell.Liquid.Parse -- | Top Level Parsing API -- ----------------------------------------------------- -- -- Used to parse .hs and .lhs files (via ApiAnnotations) hsSpecificationP :: ModuleName -> [(SourcePos, String)] -> [BPspec] -> Either [Error] (ModName, BareSpec) specSpecificationP :: SourceName -> String -> Either Error (ModName, BareSpec) singleSpecP :: SourcePos -> String -> Either Error BPspec type BPspec = Pspec LocBareType LocSymbol -- | The AST for a single parsed spec. data Pspec ty ctor -- | measure definition Meas :: Measure ty ctor -> Pspec ty ctor -- | assume signature (unchecked) Assm :: (LocSymbol, ty) -> Pspec ty ctor -- | assert signature (checked) Asrt :: (LocSymbol, ty) -> Pspec ty ctor -- | local assertion -- RJ: what is this LAsrt :: (LocSymbol, ty) -> Pspec ty ctor -- | RJ: what is this Asrts :: ([LocSymbol], (ty, Maybe [Located Expr])) -> Pspec ty ctor -- | 'import' a specification module Impt :: Symbol -> Pspec ty ctor -- | refined 'data' declaration DDecl :: DataDecl -> Pspec ty ctor -- | refined 'newtype' declaration NTDecl :: DataDecl -> Pspec ty ctor -- | refined 'class' definition Class :: RClass ty -> Pspec ty ctor -- | 'class laws' definition CLaws :: RClass ty -> Pspec ty ctor ILaws :: RILaws ty -> Pspec ty ctor -- | refined 'instance' definition RInst :: RInstance ty -> Pspec ty ctor -- | include a path -- TODO: deprecate Incl :: FilePath -> Pspec ty ctor -- | invariant specification Invt :: ty -> Pspec ty ctor -- | using declaration (for local invariants on a type) Using :: (ty, ty) -> Pspec ty ctor -- | 'type' alias declaration Alias :: Located (RTAlias Symbol BareType) -> Pspec ty ctor -- | predicate alias declaration EAlias :: Located (RTAlias Symbol Expr) -> Pspec ty ctor -- | embed declaration Embed :: (LocSymbol, FTycon, TCArgs) -> Pspec ty ctor -- | qualif definition Qualif :: Qualifier -> Pspec ty ctor -- | decreasing annotation -- TODO: deprecate Decr :: (LocSymbol, [Int]) -> Pspec ty ctor -- | lazyvar annotation, defer checks to *use* sites LVars :: LocSymbol -> Pspec ty ctor -- | lazy annotation, skip termination check on binder Lazy :: LocSymbol -> Pspec ty ctor -- | fail annotation, the binder should be unsafe Fail :: LocSymbol -> Pspec ty ctor -- | rewrite annotation, the binder generates a rewrite rule Rewrite :: LocSymbol -> Pspec ty ctor -- | rewritewith annotation, the first binder is using the rewrite -- rules of the second list Rewritewith :: (LocSymbol, [LocSymbol]) -> Pspec ty ctor -- | 'auto-inst' or ple annotation; use ple locally on binder Insts :: (LocSymbol, Maybe Int) -> Pspec ty ctor -- | measure annotation; lift Haskell binder as measure HMeas :: LocSymbol -> Pspec ty ctor -- | reflect annotation; reflect Haskell binder as function in -- logic Reflect :: LocSymbol -> Pspec ty ctor -- | inline annotation; inline (non-recursive) binder as an alias Inline :: LocSymbol -> Pspec ty ctor -- | ignore annotation; skip all checks inside this binder Ignore :: LocSymbol -> Pspec ty ctor -- | autosize annotation; automatically generate size metric for -- this type ASize :: LocSymbol -> Pspec ty ctor -- | bound annotation; lift Haskell binder as an -- abstract-refinement "bound" HBound :: LocSymbol -> Pspec ty ctor -- | bound definition PBound :: Bound ty Expr -> Pspec ty ctor -- | LIQUID pragma, used to save configuration options in source -- files Pragma :: Located String -> Pspec ty ctor -- | 'class measure' definition CMeas :: Measure ty () -> Pspec ty ctor -- | 'instance measure' definition IMeas :: Measure ty ctor -> Pspec ty ctor -- | variance annotations, marking type constructor params as co-, -- contra-, or in-variant Varia :: (LocSymbol, [Variance]) -> Pspec ty ctor -- | fixity annotation BFix :: () -> Pspec ty ctor -- | define annotation for specifying aliases c.f. -- `include-CoreToLogic.lg` Define :: (LocSymbol, Symbol) -> Pspec ty ctor parseSymbolToLogic :: SourceName -> String -> Either Error LogicMap instance GHC.Show.Show Language.Haskell.Liquid.Parse.PcScope instance GHC.Classes.Eq Language.Haskell.Liquid.Parse.PcScope instance GHC.Show.Show Language.Haskell.Liquid.Parse.ParamComp instance (Data.Data.Data ty, Data.Data.Data ctor) => Data.Data.Data (Language.Haskell.Liquid.Parse.Pspec ty ctor) instance (Language.Fixpoint.Types.PrettyPrint.PPrint ty, Language.Fixpoint.Types.PrettyPrint.PPrint ctor) => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Parse.Pspec ty ctor) module Language.Haskell.Liquid.UX.QuasiQuoter lq :: QuasiQuoter lqDec :: String -> Q [Dec] throwErrorInQ :: UserError -> Q a mkSpecDecs :: BPspec -> Either UserError [Dec] symbolName :: Symbolic s => s -> Name simplifyBareType :: LocSymbol -> BareType -> Either UserError Type simplifyBareType' :: BareType -> Simpl Type simplifyBareType'' :: ([BTyVar], [BareType]) -> BareType -> Simpl Type data Simpl a Simplified :: a -> Simpl a FoundExprArg :: SrcSpan -> Simpl a FoundHole :: Simpl a filterExprArgs :: [Simpl a] -> [Simpl a] newtype LiquidQuote LiquidQuote :: BPspec -> LiquidQuote [liquidQuoteSpec] :: LiquidQuote -> BPspec locSourcePos :: Loc -> SourcePos dataToExpQ' :: Data a => a -> Q Exp textToExpQ :: Text -> Maybe ExpQ extQ :: (Typeable a, Typeable b) => (a -> q) -> (b -> q) -> a -> q instance GHC.Base.Functor Language.Haskell.Liquid.UX.QuasiQuoter.Simpl instance Data.Data.Data Language.Haskell.Liquid.UX.QuasiQuoter.LiquidQuote instance GHC.Base.Applicative Language.Haskell.Liquid.UX.QuasiQuoter.Simpl instance GHC.Base.Monad Language.Haskell.Liquid.UX.QuasiQuoter.Simpl module Language.Haskell.Liquid.LawInstances checkLawInstances :: GhcSpecLaws -> Diagnostics module Language.Haskell.Liquid.Constraint.Types type CG = State CGInfo -- | Generation: Types -- --------------------------------------------------------- data CGInfo CGInfo :: !SEnv Sort -> ![SubC] -> ![WfC] -> ![FixSubC] -> ![FixWfC] -> !Integer -> !BindEnv -> ![BindId] -> !AnnInfo (Annot SpecType) -> !HashMap Var (HoleInfo (CGInfo, CGEnv) SpecType) -> !TyConMap -> ![(Var, [Int])] -> !HashMap TyCon SpecType -> !HashMap Var [Located Expr] -> !HashSet Var -> !HashSet Var -> !HashSet Var -> !HashSet TyCon -> !TCEmb TyCon -> !Kuts -> ![HashSet KVar] -> !SEnv Sort -> !SEnv Sort -> ![DataDecl] -> !Bool -> !Bool -> ![Error] -> !KVProf -> !Int -> HashMap BindId SrcSpan -> !Bool -> !TargetInfo -> ![(Var, SpecType)] -> !Templates -> CGInfo -- | top-level fixpoint env [fEnv] :: CGInfo -> !SEnv Sort -- | subtyping constraints over RType [hsCs] :: CGInfo -> ![SubC] -- | wellformedness constraints over RType [hsWfs] :: CGInfo -> ![WfC] -- | subtyping over Sort (post-splitting) [fixCs] :: CGInfo -> ![FixSubC] -- | wellformedness constraints over Sort (post-splitting) [fixWfs] :: CGInfo -> ![FixWfC] -- | counter for generating fresh KVars [freshIndex] :: CGInfo -> !Integer -- | set of environment binders [binds] :: CGInfo -> !BindEnv -- | existentials [ebinds] :: CGInfo -> ![BindId] -- | source-position annotation map [annotMap] :: CGInfo -> !AnnInfo (Annot SpecType) -- | information for ghc hole expressions [holesMap] :: CGInfo -> !HashMap Var (HoleInfo (CGInfo, CGEnv) SpecType) -- | information about type-constructors [tyConInfo] :: CGInfo -> !TyConMap -- | ^ Lexicographic order of decreasing args (DEPRECATED) [specDecr] :: CGInfo -> ![(Var, [Int])] -- | Mapping of new type type constructors with their refined types. [newTyEnv] :: CGInfo -> !HashMap TyCon SpecType -- | Terminating Metrics for Recursive functions [termExprs] :: CGInfo -> !HashMap Var [Located Expr] -- | Set of variables to ignore for termination checking [specLVars] :: CGInfo -> !HashSet Var -- | "Lazy binders", skip termination checking [specLazy] :: CGInfo -> !HashSet Var -- | Binders that FAILED struct termination check that MUST be checked [specTmVars] :: CGInfo -> !HashSet Var -- | ? FIX THIS [autoSize] :: CGInfo -> !HashSet TyCon -- | primitive Sorts into which TyCons should be embedded [tyConEmbed] :: CGInfo -> !TCEmb TyCon -- | Fixpoint Kut variables (denoting "back-edges"/recursive KVars) [kuts] :: CGInfo -> !Kuts -- | Fixpoint "packs" of correlated kvars [kvPacks] :: CGInfo -> ![HashSet KVar] -- | Global symbols in the refinement logic [cgLits] :: CGInfo -> !SEnv Sort -- | Distinct constant symbols in the refinement logic [cgConsts] :: CGInfo -> !SEnv Sort -- | ADTs extracted from Haskell 'data' definitions [cgADTs] :: CGInfo -> ![DataDecl] -- | Check Termination (?) [tcheck] :: CGInfo -> !Bool -- | prune unsorted refinements [pruneRefs] :: CGInfo -> !Bool -- | Errors during constraint generation [logErrors] :: CGInfo -> ![Error] -- | Profiling distribution of KVars [kvProf] :: CGInfo -> !KVProf -- | number of recursive functions seen (for benchmarks) [recCount] :: CGInfo -> !Int -- | Source Span associated with Fixpoint Binder [bindSpans] :: CGInfo -> HashMap BindId SrcSpan [allowHO] :: CGInfo -> !Bool [ghcI] :: CGInfo -> !TargetInfo -- | Refined Types of Data Constructors [dataConTys] :: CGInfo -> ![(Var, SpecType)] -- | Potentially unsorted expressions [unsorted] :: CGInfo -> !Templates data CGEnv CGE :: !SpanStack -> !REnv -> !SEnv Var -> !RDEnv -> !SEnv Sort -> !SEnv Sort -> !FEnv -> !HashSet Var -> !RTyConInv -> !RTyConInv -> !RTyConIAl -> !REnv -> !REnv -> !REnv -> TCEmb TyCon -> !TagEnv -> !Maybe TagKey -> !Maybe (HashMap Symbol SpecType) -> !HashMap Symbol CoreExpr -> !HashMap Var Expr -> !HEnv -> !LConstraint -> !Maybe (TError SpecType) -> !TargetInfo -> !Maybe Var -> CGEnv -- | Location in original source file [cgLoc] :: CGEnv -> !SpanStack -- | SpecTypes for Bindings in scope [renv] :: CGEnv -> !REnv -- | Map from free Symbols (e.g. datacons) to Var [syenv] :: CGEnv -> !SEnv Var -- | Dictionary Environment [denv] :: CGEnv -> !RDEnv -- | Global literals [litEnv] :: CGEnv -> !SEnv Sort -- | Distinct literals [constEnv] :: CGEnv -> !SEnv Sort -- | Fixpoint Environment [fenv] :: CGEnv -> !FEnv -- | recursive defs being processed (for annotations) [recs] :: CGEnv -> !HashSet Var -- | Datatype invariants [invs] :: CGEnv -> !RTyConInv -- | Datatype recursive invariants: ignored in the base case assumed in rec -- call [rinvs] :: CGEnv -> !RTyConInv -- | Datatype checkable invariants [ial] :: CGEnv -> !RTyConIAl -- | Top-level variables with (assert)-guarantees to verify [grtys] :: CGEnv -> !REnv -- | Top-level variables with assumed types [assms] :: CGEnv -> !REnv -- | Top-level variables with auto generated internal types [intys] :: CGEnv -> !REnv -- | How to embed GHC Tycons into fixpoint sorts [emb] :: CGEnv -> TCEmb TyCon -- | Map from top-level binders to fixpoint tag [tgEnv] :: CGEnv -> !TagEnv -- | Current top-level binder [tgKey] :: CGEnv -> !Maybe TagKey -- | Type of recursive function with decreasing constraints [trec] :: CGEnv -> !Maybe (HashMap Symbol SpecType) -- | Let binding that have not been checked (c.f. LAZYVARs) [lcb] :: CGEnv -> !HashMap Symbol CoreExpr -- | Polymorhic let bindings [forallcb] :: CGEnv -> !HashMap Var Expr -- | Types with holes, will need refreshing [holes] :: CGEnv -> !HEnv -- | Logical Constraints [lcs] :: CGEnv -> !LConstraint -- | error that should be reported at the user [cerr] :: CGEnv -> !Maybe (TError SpecType) -- | top-level TargetInfo [cgInfo] :: CGEnv -> !TargetInfo -- | top level function being checked [cgVar] :: CGEnv -> !Maybe Var data LConstraint LC :: [[(Symbol, SpecType)]] -> LConstraint -- | Fixpoint Environment -- ------------------------------------------------------ data FEnv FE :: !IBindEnv -> !SEnv Sort -> !SEnv BindId -> FEnv -- | Integer Keys for Fixpoint Environment [feBinds] :: FEnv -> !IBindEnv -- | Fixpoint Environment [feEnv] :: FEnv -> !SEnv Sort -- | Map from Symbol to current BindId [feIdEnv] :: FEnv -> !SEnv BindId initFEnv :: [(Symbol, Sort)] -> FEnv insertsFEnv :: FEnv -> [((Symbol, Sort), BindId)] -> FEnv -- | Helper Types: HEnv -- -------------------------------------------------------- data HEnv fromListHEnv :: [Symbol] -> HEnv elemHEnv :: Symbol -> HEnv -> Bool -- | Subtyping Constraints -- ----------------------------------------------------- data SubC SubC :: !CGEnv -> !SpecType -> !SpecType -> SubC [senv] :: SubC -> !CGEnv [lhs] :: SubC -> !SpecType [rhs] :: SubC -> !SpecType SubR :: !CGEnv -> !Oblig -> !RReft -> SubC [senv] :: SubC -> !CGEnv [oblig] :: SubC -> !Oblig [ref] :: SubC -> !RReft type FixSubC = SubC Cinfo subVar :: FixSubC -> Maybe Var data WfC WfC :: !CGEnv -> !SpecType -> WfC type FixWfC = WfC Cinfo type RTyConInv = HashMap RTyCon [RInv] mkRTyConInv :: [(Maybe Var, Located SpecType)] -> RTyConInv addRTyConInv :: RTyConInv -> SpecType -> SpecType addRInv :: RTyConInv -> (Var, SpecType) -> (Var, SpecType) type RTyConIAl = HashMap RTyCon [RInv] mkRTyConIAl :: [(a, Located SpecType)] -> RTyConInv removeInvariant :: CGEnv -> CoreBind -> (CGEnv, RTyConInv) restoreInvariant :: CGEnv -> RTyConInv -> CGEnv makeRecInvariants :: CGEnv -> [Var] -> CGEnv getTemplates :: CG Templates instance GHC.Show.Show Language.Haskell.Liquid.Constraint.Types.RInv instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Constraint.Types.CGInfo instance Control.DeepSeq.NFData Language.Haskell.Liquid.Constraint.Types.CGInfo instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Constraint.Types.SubC instance Control.DeepSeq.NFData Language.Haskell.Liquid.Constraint.Types.SubC instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Constraint.Types.WfC instance Control.DeepSeq.NFData Language.Haskell.Liquid.Constraint.Types.WfC instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Constraint.Types.CGEnv instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Constraint.Types.CGEnv instance GHC.Show.Show Language.Haskell.Liquid.Constraint.Types.CGEnv instance Control.DeepSeq.NFData Language.Haskell.Liquid.Constraint.Types.CGEnv instance Control.DeepSeq.NFData Language.Haskell.Liquid.Constraint.Types.FEnv instance Control.DeepSeq.NFData Language.Haskell.Liquid.Constraint.Types.RInv instance GHC.Base.Monoid Language.Haskell.Liquid.Constraint.Types.LConstraint instance GHC.Base.Semigroup Language.Haskell.Liquid.Constraint.Types.LConstraint module Language.Haskell.Liquid.Constraint.Qualifier giQuals :: TargetInfo -> SEnv Sort -> [Qualifier] -- | Use explicitly given qualifiers .spec or source (.hs, .lhs) files useSpcQuals :: HasConfig t => t -> Bool module Language.Haskell.Liquid.Constraint.ToFixpoint cgInfoFInfo :: TargetInfo -> CGInfo -> IO (FInfo Cinfo) fixConfig :: FilePath -> Config -> Config refinementEQs :: LocSpecType -> [(Expr, Expr)] canRewrite :: HashSet Symbol -> Expr -> Expr -> Bool module Language.Haskell.Liquid.Constraint.Fresh refreshArgsTop :: (Var, SpecType) -> CG SpecType -- | Generation: Freshness -- ----------------------------------------------------- -- -- Right now, we generate NO new pvars. Rather than clutter code with -- uRType calls, put it in one place where the above invariant is -- obviously enforced. Constraint generation should ONLY use -- freshTy_type and freshTy_expr freshTy_type :: KVKind -> CoreExpr -> Type -> CG SpecType freshTy_expr :: KVKind -> CoreExpr -> Type -> CG SpecType trueTy :: Type -> CG SpecType addKuts :: PPrint a => a -> SpecType -> CG () instance Language.Haskell.Liquid.Types.Fresh.Freshable Language.Haskell.Liquid.Constraint.Types.CG GHC.Integer.Type.Integer -- | This module defines the representation for Environments needed during -- constraint generation. module Language.Haskell.Liquid.Constraint.Env (+++=) :: (CGEnv, String) -> (Symbol, CoreExpr, SpecType) -> CG CGEnv (+=) :: CGEnv -> (String, Symbol, SpecType) -> CG CGEnv extendEnvWithVV :: CGEnv -> SpecType -> CG CGEnv addBinders :: CGEnv -> Symbol -> [(Symbol, SpecType)] -> CG CGEnv addSEnv :: CGEnv -> (String, Symbol, SpecType) -> CG CGEnv addEEnv :: CGEnv -> (Symbol, SpecType) -> CG CGEnv (-=) :: CGEnv -> Symbol -> CGEnv globalize :: CGEnv -> CGEnv fromListREnv :: [(Symbol, SpecType)] -> [(Symbol, SpecType)] -> REnv toListREnv :: REnv -> [(Symbol, SpecType)] insertREnv :: Symbol -> SpecType -> REnv -> REnv localBindsOfType :: RRType r -> REnv -> [Symbol] lookupREnv :: Symbol -> REnv -> Maybe SpecType (?=) :: (?callStack :: CallStack) => CGEnv -> Symbol -> Maybe SpecType rTypeSortedReft' :: (PPrint r, Reftable r, SubsTy RTyVar RSort r, Reftable (RTProp RTyCon RTyVar r)) => CGEnv -> Templates -> RRType r -> SortedReft setLocation :: CGEnv -> Span -> CGEnv setBind :: CGEnv -> Var -> CGEnv setRecs :: CGEnv -> [Var] -> CGEnv setTRec :: CGEnv -> [(Var, SpecType)] -> CGEnv getLocation :: CGEnv -> SrcSpan module Language.Haskell.Liquid.Synthesize.Monad localMaxMatchDepth :: SM Int -- | Synthesis Monad -- ---------------------------------------------------------- type SSEnv = HashMap Symbol (SpecType, Var) type SSDecrTerm = [(Var, [Var])] type ExprMemory = [(Type, CoreExpr, Int)] type T = HashMap Type (CoreExpr, Int) data SState SState :: !REnv -> !SSEnv -> !Int -> !SSDecrTerm -> !Context -> !CGInfo -> !CGEnv -> !Config -> !Int -> !ExprMemory -> !Int -> !Int -> !Int -> ![Var] -> !Var -> ![Type] -> !Maybe [TyVar] -> !Maybe [Type] -> !([Var], [[Type]]) -> !Int -> ![(CoreExpr, Type, TyCon)] -> SState [rEnv] :: SState -> !REnv [ssEnv] :: SState -> !SSEnv [ssIdx] :: SState -> !Int [ssDecrTerm] :: SState -> !SSDecrTerm [sContext] :: SState -> !Context [sCGI] :: SState -> !CGInfo [sCGEnv] :: SState -> !CGEnv [sFCfg] :: SState -> !Config [sDepth] :: SState -> !Int [sExprMem] :: SState -> !ExprMemory [sExprId] :: SState -> !Int [sArgsId] :: SState -> !Int [sArgsDepth] :: SState -> !Int [sUniVars] :: SState -> ![Var] [sFix] :: SState -> !Var [sGoalTys] :: SState -> ![Type] [sGoalTyVar] :: SState -> !Maybe [TyVar] [sUGoalTy] :: SState -> !Maybe [Type] [sForalls] :: SState -> !([Var], [[Type]]) [caseIdx] :: SState -> !Int [scrutinees] :: SState -> ![(CoreExpr, Type, TyCon)] type SM = StateT SState IO localMaxAppDepth :: SM Int localMaxArgsDepth :: SM Int locally :: SM a -> SM a evalSM :: SM a -> Context -> SSEnv -> SState -> IO a initState :: Context -> Config -> CGInfo -> CGEnv -> REnv -> Var -> [Var] -> SSEnv -> IO SState getSEnv :: SM SSEnv getSEMem :: SM ExprMemory getSFix :: SM Var getSUniVars :: SM [Var] getSDecrTerms :: SM SSDecrTerm addsEnv :: [(Var, SpecType)] -> SM () addsEmem :: [(Var, SpecType)] -> SM () addEnv :: Var -> SpecType -> SM () addEmem :: Var -> SpecType -> SM () addDecrTerm :: Var -> [Var] -> SM () lookupAll :: Var -> [Var] -> SSDecrTerm -> SM () thisReplace :: Int -> a -> [a] -> [a] -- | Entry point. structuralCheck :: [CoreExpr] -> SM [CoreExpr] structCheck :: Var -> CoreExpr -> (Maybe Var, [CoreExpr]) notStructural :: SSDecrTerm -> Var -> CoreExpr -> Bool isDecreasing' :: CoreExpr -> SSDecrTerm -> Bool liftCG0 :: (CGEnv -> CG CGEnv) -> SM () liftCG :: CG a -> SM a freshVarType :: Type -> SM Var freshVar :: SpecType -> SM Var withIncrDepth :: Monoid a => SM a -> SM a incrSM :: SM Int incrCase :: SM Int safeIxScruts :: Int -> [a] -> Maybe Int symbolExpr :: Type -> Symbol -> SM CoreExpr -- | Initializes ExprMemory structure. 1. Transforms refinement -- types to conventional (Haskell) types. 2. All Depths are -- initialized to 0. initExprMem :: SSEnv -> ExprMemory insEMem0 :: SSEnv -> SM ExprMemory instantiateTy :: CoreExpr -> Maybe [Type] -> CoreExpr -- | Used for instantiation: Applies types to an expression. > The -- result does not have forall. Nothing as a result suggests -- that there are more types than foralls in the expression. applyTy :: [Type] -> CoreExpr -> Maybe CoreExpr -- | Instantiation based on current goal-type. fixEMem :: SpecType -> SM () -- | Instantiate the top-level variable. instantiateTL :: SM (Type, CoreExpr) -- | Applies type variables (1st argument) to an expression. The expression -- is guaranteed to have the same level of parametricity (same number of -- forall) as the length of the 1st argument. > The result -- has zero forall. apply :: [Var] -> CoreExpr -> Maybe CoreExpr instantiate :: CoreExpr -> Maybe [Var] -> CoreExpr withTypeEs :: SpecType -> SM [CoreExpr] findCandidates :: Type -> SM ExprMemory functionCands :: Type -> SM [(Type, CoreExpr, Int)] varError :: SM Var toGhcSrc :: TargetSrc -> GhcSrc module Language.Haskell.Liquid.Synthesize.Env initSSEnv :: SpecType -> CGInfo -> SSEnv -> (SSEnv, [Var]) -- | For algebraic datatypes: Find (in the refinement type) all the -- datatypes that are used and get their constructors. tpToCons :: SpecType -> [DataCon] typeToCons :: SpecType -> [DataCon] rmMeasures :: [Symbol] -> [(Symbol, SpecType)] -> [(Symbol, SpecType)] -- | This module contains various functions that add/update in the CG -- monad. module Language.Haskell.Liquid.Constraint.Monad -- | addC adds a subtyping constraint into the global pool. addC :: SubC -> String -> CG () -- | addPost: RJ: what DOES this function do? addPost :: CGEnv -> SpecType -> CG SpecType -- | Add Well formedness Constraint addW :: WfC -> CG () -- | Add a warning addWarning :: Error -> CG () -- | Add Identifier Annotations, used for annotation binders (i.e. at -- binder sites) addIdA :: Var -> Annot SpecType -> CG () boundRecVar :: SrcSpan -> AnnInfo (Annot a) -> Bool -- | Used for annotating reads (i.e. at Var x sites) addLocA :: Maybe Var -> SrcSpan -> Annot SpecType -> CG () -- | Used for annotating holes addHole :: Var -> SpecType -> CGEnv -> CG () -- | Update annotations for a location, due to (ghost) predicate -- applications updateLocA :: Maybe SrcSpan -> SpecType -> CG () addA :: Outputable a => SrcSpan -> Maybe a -> b -> AnnInfo b -> AnnInfo b lookupNewType :: TyCon -> CG (Maybe SpecType) envToSub :: [(a, b)] -> ([(a, b)], b, b) -- | This module defines the representation of Subtyping and WF -- Constraints, and the code for syntax-directed constraint generation. module Language.Haskell.Liquid.Constraint.Init initEnv :: TargetInfo -> CG CGEnv initCGI :: Config -> TargetInfo -> CGInfo module Language.Haskell.Liquid.Constraint.Constraint constraintToLogic :: REnv -> LConstraint -> Expr addConstraints :: CGEnv -> [(Symbol, SpecType)] -> CGEnv -- | Constraint Splitting -- ------------------------------------------------------ module Language.Haskell.Liquid.Constraint.Split splitC :: SubC -> CG [FixSubC] splitW :: WfC -> CG [FixWfC] envToSub :: [(a, b)] -> ([(a, b)], b, b) -- | Constraint Generation Panic -- ----------------------------------------------- panicUnbound :: PPrint x => CGEnv -> x -> a -- | This module contains functions that convert things to their -- Bare versions, e.g. SpecType -> BareType etc. module Language.Haskell.Liquid.Bare.ToBare specToBare :: SpecType -> BareType measureToBare :: SpecMeasure -> BareMeasure module Language.Haskell.Liquid.Bare.Plugged -- | NOTE: Be *very* careful with the use functions from RType -> -- GHC.Type, e.g. toType, in this module as they cannot handle LH type -- holes. Since this module is responsible for plugging the holes we -- obviously cannot assume, as in e.g. L.H.L.Constraint.* that they do -- not appear. makePluggedSig :: ModName -> TCEmb TyCon -> TyConMap -> HashSet StableName -> PlugTV Var -> LocSpecType -> LocSpecType makePluggedDataCon :: TCEmb TyCon -> TyConMap -> Located DataConP -> Located DataConP -- | This module has the code for applying refinement (and) type aliases -- and the pipeline for "cooking" a BareType into a -- SpecType. TODO: _only_ export makeRTEnv, -- cookSpecType and maybe qualifyExpand... module Language.Haskell.Liquid.Bare.Expand -- | makeRTEnv initializes the env needed to expand -- refinements and types, that is, the below needs to be called *before* -- we use expand makeRTEnv :: Env -> ModName -> BareSpec -> ModSpecs -> LogicMap -> BareRTEnv -- | qualifyExpand first qualifies names so that we can -- successfully resolve them during expansion. qualifyExpand :: (Expand a, Qualify a) => Env -> ModName -> BareRTEnv -> SourcePos -> [Symbol] -> a -> a -- | cookSpecType is the central place where a BareType -- gets processed, in multiple steps, into a SpecType. See -- [NOTE:Cooking-SpecType] for details of each of the individual steps. cookSpecType :: Env -> SigEnv -> ModName -> PlugTV Var -> LocBareType -> LocSpecType cookSpecTypeE :: Env -> SigEnv -> ModName -> PlugTV Var -> LocBareType -> Either UserError LocSpecType specExpandType :: BareRTEnv -> LocSpecType -> LocSpecType plugHoles :: SigEnv -> ModName -> PlugTV Var -> LocSpecType -> LocSpecType instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Fixpoint.Types.Refinements.Expr instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Fixpoint.Types.Refinements.Reft instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.RReft instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.SpecType instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.BareType instance Language.Haskell.Liquid.Bare.Expand.Expand (Language.Haskell.Liquid.Types.Types.RTAlias Language.Fixpoint.Types.Names.Symbol Language.Fixpoint.Types.Refinements.Expr) instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.BareRTAlias instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.Body instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.DataCtor instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Types.DataDecl instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Specs.BareMeasure instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Types.Specs.BareDef instance Language.Haskell.Liquid.Bare.Expand.Expand Language.Haskell.Liquid.Measure.BareSpec instance Language.Haskell.Liquid.Bare.Expand.Expand a => Language.Haskell.Liquid.Bare.Expand.Expand (Language.Fixpoint.Types.Spans.Located a) instance Language.Haskell.Liquid.Bare.Expand.Expand a => Language.Haskell.Liquid.Bare.Expand.Expand (Language.Fixpoint.Types.Names.LocSymbol, a) instance Language.Haskell.Liquid.Bare.Expand.Expand a => Language.Haskell.Liquid.Bare.Expand.Expand (GHC.Maybe.Maybe a) instance Language.Haskell.Liquid.Bare.Expand.Expand a => Language.Haskell.Liquid.Bare.Expand.Expand [a] instance Language.Haskell.Liquid.Bare.Expand.Expand a => Language.Haskell.Liquid.Bare.Expand.Expand (Data.HashMap.Internal.HashMap k a) module Language.Haskell.Liquid.Bare.Laws makeInstanceLaws :: Env -> SigEnv -> [(Var, LocSpecType)] -> ModSpecs -> [LawInstance] -- | This module contains the code that DOES reflection; i.e. converts -- Haskell definitions into refinements. module Language.Haskell.Liquid.Bare.Axiom makeHaskellAxioms :: Config -> GhcSrc -> Env -> TycEnv -> ModName -> LogicMap -> GhcSpecSig -> BareSpec -> [(Var, LocSpecType, Equation)] -- | Hardcode imported reflected functions -- ------------------------------------ wiredReflects :: Config -> Env -> ModName -> GhcSpecSig -> [Var] instance Language.Haskell.Liquid.Bare.Axiom.Subable Var.Var instance Language.Haskell.Liquid.Bare.Axiom.Subable CoreSyn.CoreExpr instance Language.Haskell.Liquid.Bare.Axiom.Subable CoreSyn.CoreAlt -- | This module defines the representation of Subtyping and WF -- Constraints, and the code for syntax-directed constraint generation. module Language.Haskell.Liquid.Constraint.Generate -- | Constraint Generation: Toplevel -- ------------------------------------------- generateConstraints :: TargetInfo -> CGInfo generateConstraintsWithEnv :: TargetInfo -> CGInfo -> CGEnv -> CGInfo caseEnv :: CGEnv -> Var -> [AltCon] -> AltCon -> [Var] -> Maybe [Int] -> CG CGEnv -- | Bidirectional Constraint Generation: SYNTHESIS -- ---------------------------- consE :: CGEnv -> CoreExpr -> CG SpecType instance Data.Traversable.Traversable Language.Haskell.Liquid.Constraint.Generate.Template instance Data.Foldable.Foldable Language.Haskell.Liquid.Constraint.Generate.Template instance GHC.Base.Functor Language.Haskell.Liquid.Constraint.Generate.Template instance GHC.Show.Show a => GHC.Show.Show (Language.Haskell.Liquid.Constraint.Generate.Template a) instance Language.Fixpoint.Types.PrettyPrint.PPrint a => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Constraint.Generate.Template a) instance Control.Monad.Fail.MonadFail Data.Functor.Identity.Identity module Language.Haskell.Liquid.Synthesize.Check check :: CGInfo -> CGEnv -> Config -> Var -> CoreExpr -> Maybe SpecType -> IO Bool hasType :: SpecType -> CoreExpr -> SM Bool isWellTyped :: CoreExpr -> SM Bool checkError :: SpecType -> SM (Maybe CoreExpr) module Language.Haskell.Liquid.Synthesize.Generate genTerms :: SpecType -> SM [CoreExpr] data SearchMode -- | searching for arguments of functions that can eventually produce the -- top level hole fill ArgsMode :: SearchMode -- | searching for the hole fill ResultMode :: SearchMode genTerms' :: SearchMode -> SpecType -> SM [CoreExpr] genArgs :: SpecType -> SM [CoreExpr] withDepthFillArgs :: SpecType -> Int -> [(Type, CoreExpr, Int)] -> SM [CoreExpr] argsFill :: ExprMemory -> [(Type, CoreExpr, Int)] -> [CoreExpr] -> SM [CoreExpr] withDepthFill :: SearchMode -> SpecType -> Int -> [(Type, CoreExpr, Int)] -> SM [CoreExpr] fill :: SearchMode -> Int -> [(Type, CoreExpr, Int)] -> [CoreExpr] -> SM [CoreExpr] -- | Pruning terms for function application | -- type Depth = Int feasible :: Depth -> (CoreExpr, Int) -> Bool feasibles :: Depth -> Int -> [(CoreExpr, Int)] -> [Int] isFeasible :: Depth -> [[(CoreExpr, Int)]] -> [[Int]] findFeasibles :: Depth -> [[(CoreExpr, Int)]] -> ([[Int]], [Int]) toExpr :: [Int] -> [(CoreExpr, Int)] -> ([(CoreExpr, Int)], [(CoreExpr, Int)]) fixCands :: Int -> [Int] -> [[(CoreExpr, Int)]] -> ([[(CoreExpr, Int)]], [[(CoreExpr, Int)]]) -- | The first argument should be an 1-based index. replace :: Int -> a -> [a] -> [a] repeatFix :: [Int] -> [[Int]] -> (Type, CoreExpr, Int) -> [[(CoreExpr, Int)]] -> [CoreExpr] -> SM [CoreExpr] prune :: Depth -> (Type, CoreExpr, Int) -> [[(CoreExpr, Int)]] -> SM [CoreExpr] fillOne :: (Type, CoreExpr, Int) -> [[(CoreExpr, Int)]] -> SM [CoreExpr] applyTerm :: [CoreExpr] -> [(CoreExpr, Int)] -> Type -> SM [CoreExpr] applyArg :: [CoreExpr] -> (CoreExpr, Int) -> Type -> SM [CoreExpr] applyTerms :: [CoreExpr] -> [[(CoreExpr, Int)]] -> [Type] -> SM [CoreExpr] prodScrutinees :: [(Type, CoreExpr, Int)] -> [[[(CoreExpr, Int)]]] -> SM [CoreExpr] synthesizeScrutinee :: [Var] -> SM [CoreExpr] instance GHC.Show.Show Language.Haskell.Liquid.Synthesize.Generate.SearchMode instance GHC.Classes.Eq Language.Haskell.Liquid.Synthesize.Generate.SearchMode module Language.Haskell.Liquid.Synthesize synthesize :: FilePath -> Config -> CGInfo -> IO [Error] -- | This module contains (most of) the code needed to lift Haskell -- entitites, . code- (CoreBind), and data- (Tycon) definitions into the -- spec level. module Language.Haskell.Liquid.Bare.Measure makeHaskellMeasures :: GhcSrc -> TycEnv -> LogicMap -> BareSpec -> [Measure (Located BareType) LocSymbol] makeHaskellInlines :: GhcSrc -> TCEmb TyCon -> LogicMap -> BareSpec -> [(LocSymbol, LMap)] makeHaskellDataDecls :: Config -> ModName -> BareSpec -> [TyCon] -> [DataDecl] -- | makeMeasureSelectors converts the DataCons and creates -- the measures for the selectors and checkers that then enable -- reflection. makeMeasureSelectors :: Config -> DataConMap -> Located DataConP -> [Measure SpecType DataCon] makeMeasureSpec :: Env -> SigEnv -> ModName -> (ModName, BareSpec) -> MSpec SpecType DataCon makeMeasureSpec' :: MSpec SpecType DataCon -> ([(Var, SpecType)], [(LocSymbol, RRType Reft)]) varMeasures :: Monoid r => Env -> [(Symbol, Located (RRType r))] makeClassMeasureSpec :: MSpec (RType c tv (UReft r2)) t -> [(LocSymbol, CMeasure (RType c tv r2))] module Language.Haskell.Liquid.Bare.Class makeClasses :: Env -> SigEnv -> ModName -> ModSpecs -> ([DataConP], [(ModName, Var, LocSpecType)]) makeCLaws :: Env -> SigEnv -> ModName -> ModSpecs -> [(Class, [(ModName, Var, LocSpecType)])] makeSpecDictionaries :: Env -> SigEnv -> ModSpecs -> DEnv Var LocSpecType makeDefaultMethods :: Env -> [(ModName, Var, LocSpecType)] -> [(ModName, Var, LocSpecType)] makeMethodTypes :: DEnv Var LocSpecType -> [DataConP] -> [CoreBind] -> [(Var, MethodType LocSpecType)] module Language.Haskell.Liquid.Bare.Check -- | Checking TargetSpec checkTargetSpec :: [BareSpec] -> TargetSrc -> SEnv SortedReft -> [CoreBind] -> TargetSpec -> Either Diagnostics () -- | Checking BareSpec -- ------------------------------------------------------------------------ checkBareSpec :: ModName -> BareSpec -> Either Diagnostics () -- | This module contains the functions that convert from -- descriptions of symbols, names and types (over freshly parsed -- bare Strings), to representations connected to GHC -- Vars, Names, and Types. The actual -- representations of bare and real (refinement) types are all in -- RefType -- they are different instances of RType. module Language.Haskell.Liquid.Bare -- | makeTargetSpec constructs the TargetSpec and then -- validates it. Upon success, the TargetSpec and the -- LiftedSpec are returned. We perform error checking in "two -- phases": during the first phase, we check for errors and warnings in -- the input BareSpec and the dependencies. During this phase we -- ideally want to short-circuit in case the validation failure is found -- in one of the dependencies (to avoid printing potentially endless -- failures). The second phase involves creating the TargetSpec, -- and returning either the full list of diagnostics (errors and -- warnings) in case things went wrong, or the final TargetSpec -- and LiftedSpec together with a list of Warnings, which -- shouldn't abort the compilation (modulo explicit request from the -- user, to treat warnings and errors). makeTargetSpec :: Config -> LogicMap -> TargetSrc -> BareSpec -> TargetDependencies -> Either Diagnostics ([Warning], TargetSpec, LiftedSpec) -- | De/Serializing Spec files loadLiftedSpec :: Config -> FilePath -> IO (Maybe BareSpec) saveLiftedSpec :: FilePath -> BareSpec -> IO () module Language.Haskell.Liquid.GHC.Interface -- | realTargets mE cfg targets uses configureGhcTargets to -- return a list of files -- -- -- --
    --
  1. Where each file only (transitively imports) PRECEDIING ones;
  2. --
  3. `f1..` are a permutation of the original targets;
  4. --
  5. `i1..` either don't have "fresh" .bspec files.
  6. --
realTargets :: Maybe HscEnv -> Config -> [FilePath] -> IO [FilePath] getInterfaceDynFlags :: Maybe HscEnv -> Config -> IO DynFlags -- | GHC Interface Pipeline -- ---------------------------------------------------- getTargetInfos :: Maybe HscEnv -> Config -> [FilePath] -> IO ([TargetInfo], HscEnv) -- | GHC Configuration & Setup -- ------------------------------------------------- runLiquidGhc :: Maybe HscEnv -> Config -> Ghc a -> IO a pprintCBs :: [CoreBind] -> Doc -- | Extract Specifications from GHC -- ------------------------------------------- extractSpecComments :: ApiAnns -> [(SourcePos, String)] extractSpecQuotes' :: (a -> Module) -> (a -> [Annotation]) -> a -> [BPspec] makeLogicMap :: IO LogicMap -- | Extract Ids -- --------------------------------------------------------------- classCons :: Maybe [ClsInst] -> [Id] derivedVars :: Config -> MGIModGuts -> [Var] importVars :: CoreProgram -> [Id] -- | makeGhcSrc builds all the source-related information needed -- for consgen makeGhcSrc :: Config -> FilePath -> TypecheckedModule -> ModSummary -> Ghc GhcSrc allImports :: [LImportDecl GhcRn] -> HashSet Symbol qualifiedImports :: [LImportDecl GhcRn] -> QImports modSummaryHsFile :: ModSummary -> FilePath -- | Family instance information makeFamInstEnv :: [FamInst] -> ([TyCon], [(Symbol, DataCon)]) -- | Finding & Parsing Files -- --------------------------------------------------- -- -- Handle Spec Files -- --------------------------------------------------------- findAndParseSpecFiles :: GhcMonadLike m => Config -> HashSet FilePath -> ModSummary -> [Module] -> m [(ModName, BareSpec)] parseSpecFile :: FilePath -> IO (ModName, BareSpec) noTerm :: BareSpec -> BareSpec clearSpec :: BareSpec -> BareSpec checkFilePragmas :: GhcMonadLike m => [Located String] -> m () keepRawTokenStream :: ModSummary -> ModSummary ignoreInline :: ParsedModule -> ParsedModule -- | lookupTyThings grabs all the Names and associated -- TyThing known to GHC for this module; we will use this to -- create our name-resolution environment (see Resolve) lookupTyThings :: GhcMonadLike m => HscEnv -> ModSummary -> TcGblEnv -> m [(Name, Maybe TyThing)] -- | Returns all the available (i.e. exported) TyCons (type -- constructors) for the input Module. availableTyCons :: GhcMonadLike m => HscEnv -> ModSummary -> TcGblEnv -> [AvailInfo] -> m [TyCon] -- | Returns all the available (i.e. exported) Vars for the input -- Module. availableVars :: GhcMonadLike m => HscEnv -> ModSummary -> TcGblEnv -> [AvailInfo] -> m [Var] updLiftedSpec :: BareSpec -> Maybe BareSpec -> BareSpec loadDependenciesOf :: GhcMonad m => ModuleName -> m () instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Specs.TargetSpec instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Specs.TargetInfo instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.TargetInfo instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.TargetVars instance Language.Haskell.Liquid.UX.Tidy.Result HscTypes.SourceError module Language.Haskell.Liquid.Liquid liquid :: [String] -> IO b runLiquid :: MbEnv -> Config -> IO (ExitCode, MbEnv) type MbEnv = Maybe HscEnv liquidConstraints :: Config -> IO (Either [CGInfo] ExitCode) checkTargetInfo :: TargetInfo -> IO (Output Doc) module Language.Haskell.Liquid.Interactive.Types -- | Command -- ------------------------------------------------------------------ type Command = Config type Response = (Status, Int) status :: ExitCode -> Status -- | State -- -------------------------------------------------------------------- data State State :: Int -> MbEnv -> State [sCount] :: State -> Int [sMbEnv] :: State -> MbEnv instance GHC.Show.Show Language.Haskell.Liquid.Interactive.Types.Status instance Data.Data.Data Language.Haskell.Liquid.Interactive.Types.Status instance GHC.Generics.Generic Language.Haskell.Liquid.Interactive.Types.Status instance Data.Serialize.Serialize Language.Haskell.Liquid.Interactive.Types.Status module Language.Haskell.Liquid.Interactive.Handler initial :: State handler :: MVar State -> Command -> IO Response -- | This module provides a GHC Plugin that allows LiquidHaskell to -- be hooked directly into GHC's compilation pipeline, facilitating its -- usage and adoption. module Language.Haskell.Liquid.GHC.Plugin -- | The Plugin entrypoint -- ------------------------------------------------------ plugin :: Plugin instance Language.Haskell.Liquid.GHC.Plugin.Unoptimise DynFlags.DynFlags instance Language.Haskell.Liquid.GHC.Plugin.Unoptimise HscTypes.ModSummary instance Language.Haskell.Liquid.GHC.Plugin.Unoptimise (DynFlags.DynFlags, HscTypes.HscEnv) module LiquidHaskell lq :: QuasiQuoter -- | The Plugin entrypoint -- ------------------------------------------------------ plugin :: Plugin