-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Liquid Types for Haskell -- -- This package provides a plugin to verify Haskell programs. But most -- likely you should be using the liquidhaskell package instead, -- which rexports this plugin together with necessary specifications for -- definitions in the boot libraries. @package liquidhaskell-boot @version 0.9.6.3 -- | 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 () module Language.Haskell.Liquid.GHC.Plugin.Tutorial -- | Deriving instances of Hashable and Binary, generically. module Language.Haskell.Liquid.Types.Generics instance (GHC.Classes.Eq (GHC.Generics.Generically a), GHC.Generics.Generic a, Data.Hashable.Class.GHashable Data.Hashable.Class.Zero (GHC.Generics.Rep a)) => Data.Hashable.Class.Hashable (GHC.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 (GHC.Generics.Generically a) instance (GHC.Generics.Generic a, GHC.Classes.Eq (GHC.Generics.Rep a ())) => GHC.Classes.Eq (GHC.Generics.Generically a) module Language.Haskell.Liquid.Types.Names lenLocSymbol :: Located Symbol anyTypeSymbol :: Symbol functionComposisionSymbol :: Symbol selfSymbol :: Symbol -- | 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 -> 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 -> [String] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> [String] -> 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 -- | disable positivity check [nopositivity] :: 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 -- | expect failure from Liquid with at least one of the following messages [expectErrorContaining] :: Config -> [String] -- | expect failure from Liquid with any message [expectAnyError] :: 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 -- | Unfold invocations with undecided guards in PLE [pleWithUndecidedGuards] :: Config -> Bool -- | Enable proof-by-logical-evaluation [oldPLE] :: Config -> Bool -- | Use an interpreter to assist PLE [interpreter] :: 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 -- | enable typeclass support. [typeclass] :: Config -> Bool [auxInline] :: Config -> Bool -- | Enable termination checking for rewriting [rwTerminationCheck] :: Config -> Bool -- | Skip this module entirely (don't even compile any specs in it) [skipModule] :: Config -> Bool [noLazyPLE] :: Config -> Bool -- | Maximum PLE "fuel" (unfold depth) (default=infinite) [fuel] :: Config -> Maybe Int -- | Perform environment reduction [environmentReduction] :: Config -> Bool -- | Don't perform environment reduction [noEnvironmentReduction] :: Config -> Bool -- | Inline ANF bindings. Sometimes improves performance and sometimes -- worsens it. [inlineANFBindings] :: Config -> Bool -- | Use pandoc to generate html [pandocHtml] :: Config -> Bool [excludeAutomaticAssumptionsFor] :: Config -> [String] 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 Language.Haskell.Liquid.UX.SimpleVersion -- | Generate a string like Version 1.2, Git revision 1234. -- -- $(simpleVersion …) :: String Taken from -- https://hackage.haskell.org/package/optparse-simple-0.1.1.4/docs/Options-Applicative-Simple.html#v:simpleVersion -- so we can drop the dependency on optparse-simple. simpleVersion :: Version -> Q Exp module Liquid.GHC.API.StableModule -- | A newtype wrapper around a Module which: -- -- data StableModule -- | Creates a new StableModule out of a ModuleName and a -- UnitId. mkStableModule :: UnitId -> ModuleName -> StableModule unStableModule :: StableModule -> Module -- | Converts a Module into a StableModule. toStableModule :: Module -> StableModule renderModule :: Module -> String instance GHC.Generics.Generic Liquid.GHC.API.StableModule.StableModule instance Data.Hashable.Class.Hashable Liquid.GHC.API.StableModule.StableModule instance GHC.Classes.Ord Liquid.GHC.API.StableModule.StableModule instance GHC.Classes.Eq Liquid.GHC.API.StableModule.StableModule instance GHC.Show.Show Liquid.GHC.API.StableModule.StableModule instance Data.Binary.Class.Binary Liquid.GHC.API.StableModule.StableModule instance Data.Hashable.Class.Hashable Language.Haskell.Syntax.Module.Name.ModuleName module Liquid.GHC.API.Extra -- | Abstraction of EpaComment. data ApiComment ApiLineComment :: String -> ApiComment ApiBlockComment :: String -> ApiComment -- | Extract top-level comments from a module. apiComments :: ParsedModule -> [Located ApiComment] apiCommentsParsedSource :: Located (HsModule GhcPs) -> [Located ApiComment] dataConSig :: DataCon -> ([TyCoVar], ThetaType, [Type], Type) -- | Desugar a typechecked module. desugarModuleIO :: HscEnv -> ModSummary -> TypecheckedModuleLH -> IO ModGuts fsToUnitId :: FastString -> UnitId -- | Tells if a case alternative calls to patError isPatErrorAlt :: CoreAlt -> Bool lookupModSummary :: HscEnv -> ModuleName -> Maybe ModSummary modInfoLookupNameIO :: HscEnv -> ModuleInfoLH -> Name -> IO (Maybe TyThing) moduleInfoTc :: HscEnv -> TcGblEnv -> IO ModuleInfoLH parseModuleIO :: HscEnv -> ModSummary -> IO ParsedModule qualifiedNameFS :: Name -> FastString -- | The collection of dependencies and usages modules which are relevant -- for liquidHaskell relevantModules :: ModuleGraph -> ModGuts -> Set Module renderWithStyle :: DynFlags -> SDoc -> PprStyle -> String showPprQualified :: Outputable a => a -> String showSDocQualified :: SDoc -> String strictNothing :: Maybe a thisPackage :: DynFlags -> UnitId tyConRealArity :: TyCon -> Int typecheckModuleIO :: HscEnv -> ParsedModule -> IO TypecheckedModuleLH instance GHC.Show.Show Liquid.GHC.API.Extra.ApiComment instance GHC.Classes.Eq Liquid.GHC.API.Extra.ApiComment -- | This module re-exports all identifiers that LH needs from the GHC API. -- -- The intended use of this module is to provide a quick look of what GHC -- API features LH depends upon. -- -- The transitive dependencies of this module shouldn't contain modules -- from Language.Haskell.Liquid.* or other non-boot libraries. This makes -- it easy to discover breaking changes in the GHC API. module Liquid.GHC.API 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] (EQ1) 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. Note [When we quantify over a coercion variable] INVARIANT: -- If the binder is a coercion variable, it must be mentioned in the -- Type. See Note [Unused coercion variable in ForAllTy] ForAllTy :: {-# UNPACK #-} !ForAllTyBinder -> Type -> Type -- | FUN m t1 t2 Very common, so an important special case See Note -- [Function types] FunTy :: FunTyFlag -> Mult -> Type -> 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 reflexive (EQ2) INVARIANT: The Type is not a CastTy (use TransCo -- instead) (EQ3) INVARIANT: The Type is not a ForAllTy over a tyvar -- (EQ4) See Note [Respecting definitional equality] 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 -- | 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 -- GHC.Unit.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 -- | A unique, unambiguous name for something, containing information about -- where that thing originated. data () => Name -- | A ModuleName is essentially a simple string, e.g. Data.List. data () => ModuleName -- | A UnitId identifies a built library in a database and is used to -- generate unique symbols, etc. It's usually of the form: -- -- pkgname-1.2:libname+hash -- -- These UnitId 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 as we can cheaply instantiate them -- on-the-fly, cf VirtUnit). Put another way, an installed unit id is -- either fully instantiated, or not instantiated at all. data () => UnitId -- | A Module is a pair of a Unit and a ModuleName. type Module = GenModule Unit -- | Source Location data () => SrcLoc -- | 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. -- -- If you edit this type, you may need to update the GHC formalism See -- Note [GHC Formalism] in GHC.Core.Lint data () => TyCon -- | Variable -- -- Essentially a typed Name, that may also contain some additional -- information about the Var and its use sites. data () => Var data () => Pair a Pair :: a -> a -> Pair a -- | 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 GHC.Core.Opt.Arity type Arity = Int -- | The key type representing kinds in the compiler. type Kind = Type -- | A constructor-like thing data () => ConLike RealDataCon :: DataCon -> ConLike -- | 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 -> FunTyFlag -> FunTyFlag -> CoercionN -> 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 SelCo :: CoSel -> 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 data () => Fixity Fixity :: SourceText -> Int -> FixityDirection -> Fixity -- | 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) data () => Alt b Alt :: AltCon -> [b] -> Expr b -> Alt b -- | A Cost Centre is a single {-# SCC #-} annotation. data () => CostCentre -- | 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 -- | 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 class of types that represent a multiline document, with support for -- vertical composition. -- -- See Note [HLine versus HDoc] and Note [The outputable class hierarchy] -- for more details. class (IsOutput doc, IsLine Line doc) => IsDoc doc where { type family Line doc = (r :: Type) | r -> doc; } line :: IsDoc doc => Line doc -> doc -- | Join two docs together vertically. If there is no vertical -- overlap it "dovetails" the two onto one line. ($$) :: IsDoc doc => doc -> doc -> doc lines_ :: IsDoc doc => [Line doc] -> doc -- | Concatenate docs vertically with dovetailing. vcat :: IsDoc doc => [doc] -> doc -- | Prints as either the given SDoc or the given HDoc, -- depending on which type the result is instantiated to. This should -- generally be avoided; see Note [dualLine and dualDoc] for details. dualDoc :: IsDoc doc => SDoc -> HDoc -> doc type family Line doc = (r :: Type) | r -> doc data () => Env gbl lcl -- | Class designating that some type has an SDoc representation class () => Outputable a ppr :: Outputable a => a -> SDoc -- | 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 -- | A problem with the command line arguments, but don't print usage. CmdLineError :: String -> GhcException -- | An error in the user's code, probably. ProgramError :: String -> GhcException -- | Represents a pretty-printable document. -- -- To display an SDoc, use printSDoc, printSDocLn, -- bufLeftRenderSDoc, or renderWithContext. Avoid calling -- runSDoc directly as it breaks the abstraction layer. data () => SDoc -- | Represents an annotation after it has been sufficiently desugared from -- it's initial form of AnnDecl data () => Annotation Annotation :: CoreAnnTarget -> AnnPayload -> Annotation -- | The target of the annotation [ann_target] :: Annotation -> CoreAnnTarget [ann_value] :: Annotation -> AnnPayload -- | A Haskell expression. data () => HsExpr p -- | Variable See Note [Located RdrNames] HsVar :: XVar p -> LIdP p -> HsExpr p -- | Overloaded literals HsOverLit :: XOverLitE p -> HsOverLit p -> HsExpr p -- | Expression with an explicit type signature. e :: type -- -- ExprWithTySig :: XExprWithTySig p -> LHsExpr p -> LHsSigWcType (NoGhcTc p) -> HsExpr p -- | 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 -- | Identifier type Id = Var -- | TcGblEnv describes the top-level of the module at the point at -- which the typechecker is finished work. It is this structure that is -- handed on to the desugarer For state that needs to be updated during -- the typechecking phase and returned at end, use a TcRef (= -- IORef). data () => TcGblEnv -- | 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 -- | 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 -- | Plugin is the compiler plugin data type. Try to avoid -- constructing one of these directly, and just modify some fields of -- defaultPlugin instead: this is to try and preserve source-code -- compatibility when we add fields to this. -- -- Nonetheless, this API is preliminary and highly likely to change in -- the future. data () => Plugin Plugin :: CorePlugin -> TcPlugin -> DefaultingPlugin -> HoleFitPlugin -> ([CommandLineOption] -> HscEnv -> IO HscEnv) -> ([CommandLineOption] -> IO PluginRecompile) -> ([CommandLineOption] -> ModSummary -> ParsedResult -> Hsc ParsedResult) -> ([CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)) -> ([CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv) -> ([CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)) -> (forall lcl. () => [CommandLineOption] -> ModIface -> IfM lcl ModIface) -> Plugin -- | Modify the Core pipeline that will be used for compilation. This is -- called as the Core pipeline is built for every module being compiled, -- and plugins get the opportunity to modify the pipeline in a -- nondeterministic order. [installCoreToDos] :: Plugin -> CorePlugin -- | An optional typechecker plugin, which may modify the behaviour of the -- constraint solver. [tcPlugin] :: Plugin -> TcPlugin -- | An optional defaulting plugin, which may specify the additional -- type-defaulting rules. [defaultingPlugin] :: Plugin -> DefaultingPlugin -- | An optional plugin to handle hole fits, which may re-order or change -- the list of valid hole fits and refinement hole fits. [holeFitPlugin] :: Plugin -> HoleFitPlugin -- | An optional plugin to update HscEnv, right after plugin -- loading. This can be used to register hooks or tweak any field of -- DynFlags before doing actual work on a module. [driverPlugin] :: Plugin -> [CommandLineOption] -> HscEnv -> IO HscEnv -- | Specify how the plugin should affect recompilation. [pluginRecompile] :: Plugin -> [CommandLineOption] -> IO PluginRecompile -- | Modify the module when it is parsed. This is called by -- GHC.Driver.Main when the parser has produced no or only -- non-fatal errors. Compilation will fail if the messages produced by -- this function contain any errors. [parsedResultAction] :: Plugin -> [CommandLineOption] -> ModSummary -> ParsedResult -> Hsc ParsedResult -- | Modify each group after it is renamed. This is called after each -- HsGroup has been renamed. [renamedResultAction] :: Plugin -> [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn) -- | Modify the module when it is type checked. This is called at the very -- end of typechecking. [typeCheckResultAction] :: Plugin -> [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv -- | Modify the TH splice or quasiqoute before it is run. [spliceRunAction] :: Plugin -> [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc) -- | Modify an interface that have been loaded. This is called by -- GHC.Iface.Load when an interface is successfully loaded. Not -- applied to the loading of the plugin interface. Tools that rely on -- information from modules other than the currently compiled one should -- implement this function. [interfaceLoadAction] :: Plugin -> forall lcl. () => [CommandLineOption] -> ModIface -> IfM lcl ModIface -- | 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 -- | See Note [Roles] in GHC.Core.Coercion -- -- Order of constructors matters: the Ord instance coincides with the -- *super*typing relation on roles. data () => Role data () => Boxity Boxed :: Boxity -- | Maps the "normal" id type for a given pass type family IdP p -- | 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 -- | Indicates whether a module name is referring to a boot interface -- (hs-boot file) or regular module (hs file). We need to treat boot -- modules specially when building compilation graphs, since they break -- cycles. Regular source files and signature files are treated -- equivalently. data () => IsBootInterface NotBoot :: IsBootInterface IsBoot :: IsBootInterface -- | A class of types that represent a single logical line of text, with -- support for horizontal composition. -- -- See Note [HLine versus HDoc] and Note [The outputable class hierarchy] -- for more details. class IsOutput doc => IsLine doc char :: IsLine doc => Char -> doc text :: IsLine doc => String -> doc ftext :: IsLine doc => FastString -> doc ztext :: IsLine doc => FastZString -> doc -- | Join two docs together horizontally with a gap between them. (<+>) :: IsLine doc => doc -> doc -> doc -- | Separate: is either like hsep or like vcat, depending on -- what fits. sep :: IsLine doc => [doc] -> doc -- | A paragraph-fill combinator. It's much like sep, only it keeps -- fitting things on one line until it can't fit any more. fsep :: IsLine doc => [doc] -> doc -- | Concatenate docs horizontally without gaps. hcat :: IsLine doc => [doc] -> doc -- | Concatenate docs horizontally with a space between each one. hsep :: IsLine doc => [doc] -> doc -- | Prints as either the given SDoc or the given HLine, -- depending on which type the result is instantiated to. This should -- generally be avoided; see Note [dualLine and dualDoc] for details. dualLine :: IsLine doc => SDoc -> HLine -> doc -- | A superclass for IsLine and IsDoc that provides an -- identity, empty, as well as access to the shared -- SDocContext. -- -- See Note [The outputable class hierarchy] for more details. class () => IsOutput doc empty :: IsOutput doc => doc docWithContext :: IsOutput doc => (SDocContext -> doc) -> doc -- | Represents a (possibly empty) sequence of lines that can be -- efficiently printed directly to a Handle (actually a -- BufHandle). See Note [SDoc versus HDoc] and Note [HLine versus -- HDoc] for more details. data () => HDoc -- | Represents a single line of output that can be efficiently printed -- directly to a Handle (actually a BufHandle). See Note -- [SDoc versus HDoc] and Note [HLine versus HDoc] for more details. data () => HLine -- | When we print a binder, we often want to print its type too. The -- OutputableBndr class encapsulates this idea. class Outputable a => OutputableBndr a pprBndr :: OutputableBndr a => BindingSite -> a -> SDoc pprPrefixOcc :: OutputableBndr a => a -> SDoc pprInfixOcc :: OutputableBndr a => a -> SDoc bndrIsJoin_maybe :: OutputableBndr a => a -> Maybe Int -- | BindingSite is used to tell the thing that prints binder what -- language construct is binding the identifier. This can be used to -- decide how much info to print. Also see Note [Binding-site specific -- printing] in GHC.Core.Ppr data () => BindingSite -- | The x in (x. e) LambdaBind :: BindingSite -- | The x in case scrut of x { (y,z) -> ... } CaseBind :: BindingSite -- | The y,z in case scrut of x { (y,z) -> ... } CasePatBind :: BindingSite -- | The x in (let x = rhs in e) LetBind :: BindingSite -- | Wrapper for types having a Outputable instance when an OutputableP -- instance is required. newtype () => PDoc a PDoc :: a -> PDoc a -- | Outputable class with an additional environment value -- -- See Note [The OutputableP class] class () => OutputableP env a pdoc :: OutputableP env a => env -> a -> SDoc data () => SDocContext SDC :: !PprStyle -> !Scheme -> !PprColour -> !Bool -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !FastString -> SDoc -> SDocContext [sdocStyle] :: SDocContext -> !PprStyle [sdocColScheme] :: SDocContext -> !Scheme -- | The most recently used colour. This allows nesting colours. [sdocLastColour] :: SDocContext -> !PprColour [sdocShouldUseColor] :: SDocContext -> !Bool [sdocDefaultDepth] :: SDocContext -> !Int [sdocLineLength] :: SDocContext -> !Int -- | True if Unicode encoding is supported and not disabled by -- GHC_NO_UNICODE environment variable [sdocCanUseUnicode] :: SDocContext -> !Bool [sdocHexWordLiterals] :: SDocContext -> !Bool [sdocPprDebug] :: SDocContext -> !Bool [sdocPrintUnicodeSyntax] :: SDocContext -> !Bool [sdocPrintCaseAsLet] :: SDocContext -> !Bool [sdocPrintTypecheckerElaboration] :: SDocContext -> !Bool [sdocPrintAxiomIncomps] :: SDocContext -> !Bool [sdocPrintExplicitKinds] :: SDocContext -> !Bool [sdocPrintExplicitCoercions] :: SDocContext -> !Bool [sdocPrintExplicitRuntimeReps] :: SDocContext -> !Bool [sdocPrintExplicitForalls] :: SDocContext -> !Bool [sdocPrintPotentialInstances] :: SDocContext -> !Bool [sdocPrintEqualityRelations] :: SDocContext -> !Bool [sdocSuppressTicks] :: SDocContext -> !Bool [sdocSuppressTypeSignatures] :: SDocContext -> !Bool [sdocSuppressTypeApplications] :: SDocContext -> !Bool [sdocSuppressIdInfo] :: SDocContext -> !Bool [sdocSuppressCoercions] :: SDocContext -> !Bool [sdocSuppressCoercionTypes] :: SDocContext -> !Bool [sdocSuppressUnfoldings] :: SDocContext -> !Bool [sdocSuppressVarKinds] :: SDocContext -> !Bool [sdocSuppressUniques] :: SDocContext -> !Bool [sdocSuppressModulePrefixes] :: SDocContext -> !Bool [sdocSuppressStgExts] :: SDocContext -> !Bool [sdocSuppressStgReps] :: SDocContext -> !Bool [sdocErrorSpans] :: SDocContext -> !Bool [sdocStarIsType] :: SDocContext -> !Bool [sdocLinearTypes] :: SDocContext -> !Bool [sdocListTuplePuns] :: SDocContext -> !Bool [sdocPrintTypeAbbreviations] :: SDocContext -> !Bool -- | Used to map UnitIds to more friendly "package-version:component" -- strings while pretty-printing. -- -- Use pprWithUnitState to set it. Users should never have to set -- it to pretty-print SDocs emitted by GHC, otherwise it's a bug. It's an -- internal field used to thread the UnitState so that the Outputable -- instance of UnitId can use it. -- -- See Note [Pretty-printing UnitId] in GHC.Unit for more details. -- -- Note that we use FastString instead of UnitId to avoid -- boring module inter-dependency issues. [sdocUnitIdForUser] :: SDocContext -> !FastString -> SDoc data () => QualifyName NameUnqual :: QualifyName NameQual :: ModuleName -> QualifyName NameNotInScope1 :: QualifyName NameNotInScope2 :: QualifyName newtype () => IsEmptyOrSingleton IsEmptyOrSingleton :: Bool -> IsEmptyOrSingleton data () => PromotedItem PromotedItemListSyntax :: IsEmptyOrSingleton -> PromotedItem PromotedItemTupleSyntax :: PromotedItem PromotedItemDataCon :: OccName -> PromotedItem -- | Flags that affect whether a promotion tick is printed. data () => PromotionTickContext PromTickCtx :: !Bool -> !Bool -> PromotionTickContext [ptcListTuplePuns] :: PromotionTickContext -> !Bool [ptcPrintRedundantPromTicks] :: PromotionTickContext -> !Bool -- | Given a promoted data constructor, decide whether to print a tick to -- disambiguate the namespace. type QueryPromotionTick = PromotedItem -> Bool -- | For a given package, we need to know whether to print it with the -- component id to disambiguate it. type QueryQualifyPackage = Unit -> Bool -- | For a given module, we need to know whether to print it with a package -- name to disambiguate it. type QueryQualifyModule = Module -> Bool -- | Given a Name's Module and OccName, decide -- whether and how to qualify it. type QueryQualifyName = Module -> OccName -> QualifyName -- | 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 () => NamePprCtx QueryQualify :: QueryQualifyName -> QueryQualifyModule -> QueryQualifyPackage -> QueryPromotionTick -> NamePprCtx [queryQualifyName] :: NamePprCtx -> QueryQualifyName [queryQualifyModule] :: NamePprCtx -> QueryQualifyModule [queryQualifyPackage] :: NamePprCtx -> QueryQualifyPackage [queryPromotionTick] :: NamePprCtx -> QueryPromotionTick data () => Depth AllTheWay :: Depth -- | 0 => stop PartWay :: Int -> Depth -- | Use sdocDefaultDepth field as depth DefaultDepth :: Depth data () => PprStyle PprUser :: NamePprCtx -> Depth -> Coloured -> PprStyle PprDump :: NamePprCtx -> PprStyle -- | Print code; either C or assembler PprCode :: PprStyle -- | Identifier Details -- -- The IdDetails of an Id give stable, and necessary, -- information about the Id. data () => IdDetails VanillaId :: IdDetails -- | The Id for a record selector RecSelId :: RecSelParent -> Bool -> IdDetails -- | The Id is for a data constructor worker DataConWorkId :: DataCon -> IdDetails -- | The Id is for a data constructor wrapper DataConWrapId :: DataCon -> IdDetails -- | Identifier Information -- -- An IdInfo gives optional information about an -- Id. If present it never lies, but it may not be present, in -- which case there is always a conservative assumption which can be -- made. -- -- Two Ids may have different info even though they have the -- same Unique (and are hence the same Id); for -- example, one might lack the properties attached to the other. -- -- Most of the IdInfo gives information about the value, or -- definition, of the Id, independent of its usage. Exceptions -- to this are demandInfo, occInfo, oneShotInfo and -- callArityInfo. -- -- Performance note: when we update IdInfo, we have to reallocate -- this entire record, so it is a good idea not to let this data -- structure get too big. data () => IdInfo -- | Class of things that we can obtain a Unique from class () => Uniquable a getUnique :: Uniquable a => a -> Unique -- | A class allowing convenient access to the Name of various -- datatypes class () => NamedThing a getOccName :: NamedThing a => a -> OccName getName :: NamedThing a => a -> Name -- | Type or kind Variable type TyVar = Var -- | Whether an Invisible argument may appear in source Haskell. data () => Specificity -- | the argument may appear in source Haskell, but isn't required. SpecifiedSpec :: Specificity data () => VarBndr var argf Bndr :: var -> argf -> VarBndr var argf -- | The non-dependent version of ForAllTyFlag. See Note [FunTyFlag] -- Appears here partly so that it's together with its friends -- ForAllTyFlag and ForallVisFlag, but also because it is used in -- IfaceType, rather early in the compilation chain data () => FunTyFlag FTF_T_T :: FunTyFlag -- | ForAllTyFlag -- -- 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, ForAllTyBinders, TyConBinders, -- and visibility] in GHC.Core.TyCo.Rep data () => ForAllTyFlag Required :: ForAllTyFlag -- | Expressions where binders are CoreBndrs type CoreExpr = Expr CoreBndr -- | The common case for the type of binders and variables when we are -- manipulating the Core language within GHC type CoreBndr = Var -- | 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 [Core letrec invariant] See Note [Core let-can-float -- invariant] See Note [Representation polymorphism invariants] See Note -- [Core 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 -> CoercionR -> Expr b Tick :: CoreTickish -> Expr b -> Expr b Type :: Type -> Expr b Coercion :: Coercion -> Expr b infixl 4 `App` -- | 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 -- GHC.Tc.Utils.Env for how to retrieve a TyThing given a -- Name. data () => TyThing AnId :: Id -> TyThing AConLike :: ConLike -> TyThing ATyCon :: TyCon -> TyThing -- | 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 data () => TyLit NumTyLit :: Integer -> TyLit StrTyLit :: FastString -> TyLit CharTyLit :: Char -> TyLit -- | 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 -- | 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 -- | A monad for generating unique identifiers class Monad m => MonadUnique (m :: Type -> Type) -- | Get a new unique identifier getUniqueM :: MonadUnique m => m Unique type Located = GenLocated 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 data () => UnhelpfulSpanReason UnhelpfulNoLocationInfo :: UnhelpfulSpanReason UnhelpfulWiredIn :: UnhelpfulSpanReason UnhelpfulInteractive :: UnhelpfulSpanReason UnhelpfulGenerated :: UnhelpfulSpanReason UnhelpfulOther :: !FastString -> UnhelpfulSpanReason -- | 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 -> !Maybe BufSpan -> SrcSpan UnhelpfulSpan :: !UnhelpfulSpanReason -> SrcSpan -- | 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 -- | Real Source Location -- -- Represents a single point within a file data () => RealSrcLoc 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 -- | Fields in an algebraic record type; see Note [FieldLabel]. data () => FieldLabel data () => Bag a -- | 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 data () => FixityDirection InfixR :: FixityDirection InfixN :: FixityDirection -- | Enumerates the simple on-or-off dynamic flags data () => GeneralFlag Opt_Haddock :: GeneralFlag Opt_DeferTypedHoles :: GeneralFlag -- |
--   -fPIC
--   
Opt_PIC :: GeneralFlag Opt_ImplicitImportQualified :: GeneralFlag Opt_KeepRawTokenStream :: GeneralFlag type ModuleNameWithIsBoot = GenWithIsBoot ModuleName -- | This data type just pairs a value mod with an IsBootInterface -- flag. In practice, mod is usually a Module or -- ModuleName'. data () => GenWithIsBoot mod -- | Module Location -- -- Where a module lives on the file system: the actual locations of the -- .hs, .hi, .dyn_hi, .o, .dyn_o and .hie files, if we have them. -- -- For a module in another unit, the ml_hs_file and ml_obj_file -- components of ModLocation are undefined. -- -- The locations specified by a ModLocation may or may not correspond to -- actual files yet: for example, even if the object file doesn't exist, -- the ModLocation still contains the path to where the object file will -- reside if/when it is created. -- -- The paths of anything which can affect recompilation should be placed -- inside ModLocation. -- -- When a ModLocation is created none of the filepaths will have -boot -- suffixes. This is because in --make mode the ModLocation is put in the -- finder cache which is indexed by ModuleName, when a ModLocation is -- retrieved from the FinderCache the boot suffixes are appended. The -- other case is in -c mode, there the ModLocation immediately gets given -- the boot suffixes in mkOneShotModLocation. data () => ModLocation -- | Package-qualifier after renaming -- -- Renaming detects if "this" or the unit-id of the home-unit was used as -- a package qualifier. data () => PkgQual -- | No package qualifier NoPkgQual :: PkgQual -- | Located Haskell Expression type LHsExpr p = XRec p HsExpr p -- | Is a TyCon a promoted data constructor or just a normal type -- constructor? data () => PromotionFlag NotPromoted :: PromotionFlag data () => InlinePragma -- | Untyped Phase description data () => Phase StopLn :: Phase -- | A general-purpose pretty-printing precedence type. data () => PprPrec data () => TopLevelFlag NotTopLevel :: TopLevelFlag -- | A data constructor -- -- data () => DataCon type TyVarBinder = VarBndr TyVar ForAllTyFlag -- | Dictionary Function Identifier type DFunId = Id -- | A non-deterministic Variable Set -- -- A non-deterministic set of variables. See Note [Deterministic UniqFM] -- in GHC.Types.Unique.DFM for explanation why it's not -- deterministic and why it matters. Use DVarSet if the set eventually -- gets converted into a list or folded over in a way where the order -- changes the generated code, for example when abstracting variables. type VarSet = UniqSet Var -- | Records what things are "available", i.e. in scope data () => AvailInfo -- | An ordinary identifier in scope, or a field label without a parent -- type (see Note [Representing pattern synonym fields in AvailInfo]). Avail :: GreName -> 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 -> [GreName] -> AvailInfo -- | Import Item Specification -- -- Describes import info a particular Name data () => ImpItemSpec -- | The import had no import list, or had a hiding list ImpAll :: 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 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 type LocatedN = GenLocated SrcSpanAnnN type GhcRn = GhcPass 'Renamed type GhcPs = GhcPass 'Parsed -- | Located Import Declaration type LImportDecl pass = XRec pass ImportDecl pass -- | An annotation target data () => AnnTarget name -- | We are annotating a particular module ModuleTarget :: Module -> AnnTarget name type AnnPayload = Serialized -- | For now, we work only with nominal equality. data () => CoAxiomRule CoAxiomRule :: FastString -> [Role] -> Role -> ([TypeEqn] -> Maybe TypeEqn) -> CoAxiomRule -- | A CoAxiom is a "coercion constructor", i.e. a named equality -- axiom. data () => CoAxiom (br :: BranchFlag) type Branched = 'Branched data () => Class data () => TyConBndrVis AnonTCB :: FunTyFlag -> TyConBndrVis type TyConBinder = VarBndr TyVar TyConBndrVis data () => GenTickish (pass :: TickishPass) -- | An {-# SCC #-} profiling annotation, either automatically -- added by the desugarer as a result of -auto-all, or added by the user. ProfNote :: CostCentre -> !Bool -> !Bool -> GenTickish (pass :: TickishPass) -- | the cost centre [profNoteCC] :: GenTickish (pass :: TickishPass) -> CostCentre -- | bump the entry count? [profNoteCount] :: GenTickish (pass :: TickishPass) -> !Bool -- | scopes over the enclosed expression (i.e. not just a tick) [profNoteScope] :: GenTickish (pass :: TickishPass) -> !Bool -- | A "tick" used by HPC to track the execution of each subexpression in -- the original source code. HpcTick :: Module -> !Int -> GenTickish (pass :: TickishPass) [tickModule] :: GenTickish (pass :: TickishPass) -> Module [tickId] :: GenTickish (pass :: TickishPass) -> !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 :: XBreakpoint pass -> !Int -> [XTickishId pass] -> GenTickish (pass :: TickishPass) [breakpointExt] :: GenTickish (pass :: TickishPass) -> XBreakpoint pass [breakpointId] :: GenTickish (pass :: TickishPass) -> !Int -- | the order of this list is important: it matches the order of the lists -- in the appropriate entry in ModBreaks. -- -- Careful about substitution! See Note [substTickish] in -- GHC.Core.Subst. [breakpointFVs] :: GenTickish (pass :: TickishPass) -> [XTickishId pass] -- | 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 -> GenTickish (pass :: TickishPass) -- | Source covered [sourceSpan] :: GenTickish (pass :: TickishPass) -> RealSrcSpan -- | Name for source location (uses same names as CCs) [sourceName] :: GenTickish (pass :: TickishPass) -> String type CoreTickish = GenTickish 'TickishPassCore -- | Numeric literal type data () => LitNumType -- | Int# - according to target machine LitNumInt :: LitNumType -- | 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. LitNumber :: !LitNumType -> !Integer -> 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 -- | Float#. Create with mkLitFloat LitFloat :: Rational -> Literal -- | Double#. Create with mkLitDouble LitDouble :: Rational -> Literal -- | Used to describe warnings and errors o The message has a -- file/line/column heading, plus "warning:" or "error:", added by -- mkLocMessage o With SevIgnore the message is suppressed o -- Output is intended for end users data () => Severity SevWarning :: Severity -- | The class for a diagnostic message. The main purpose is to classify a -- message within GHC, to distinguish it from a debug/dump message vs a -- proper diagnostic, for which we include a DiagnosticReason. data () => MessageClass -- | Diagnostics from the compiler. This constructor is very powerful as it -- allows the construction of a MessageClass with a completely -- arbitrary permutation of Severity and DiagnosticReason. -- As such, users are encouraged to use the mkMCDiagnostic smart -- constructor instead. Use this constructor directly only if you need to -- construct and manipulate diagnostic messages directly, for example -- inside Error. In all the other circumstances, especially -- when emitting compiler diagnostics, use the smart constructor. -- -- The Maybe DiagnosticCode field carries a code (if -- available) for this diagnostic. If you are creating a message not tied -- to any error-message type, then use Nothing. In the long run, this -- really should always have a DiagnosticCode. See Note -- [Diagnostic codes]. MCDiagnostic :: Severity -> DiagnosticReason -> Maybe DiagnosticCode -> MessageClass -- | An envelope for GHC's facts about a running program, parameterised -- over the domain-specific (i.e. parsing, typecheck-renaming, -- etc) diagnostics. -- -- To say things differently, GHC emits diagnostics about the -- running program, each of which is wrapped into a MsgEnvelope -- that carries specific information like where the error happened, etc. -- Finally, multiple MsgEnvelopes are aggregated into -- Messages that are returned to the user. data () => MsgEnvelope e -- | The reason why a Diagnostic was emitted in the first -- place. Diagnostic messages are born within GHC with a very precise -- reason, which can be completely statically-computed (i.e. this is an -- error or a warning no matter what), or influenced by the specific -- state of the DynFlags at the moment of the creation of a new -- Diagnostic. For example, a parsing error is always going -- to be an error, whereas a 'WarningWithoutFlag Opt_WarnUnusedImports' -- might turn into an error due to '-Werror' or -- '-Werror=warn-unused-imports'. Interpreting a DiagnosticReason -- together with its associated Severity gives us the full -- picture. data () => DiagnosticReason -- | Born as a warning. WarningWithoutFlag :: DiagnosticReason -- | A class identifying a diagnostic. Dictionary.com defines a diagnostic -- as: -- -- "a message output by a computer diagnosing an error in a computer -- program, computer system, or component device". -- -- A Diagnostic carries the actual description of the -- message (which, in GHC's case, it can be an error or a warning) and -- the reason why such message was generated in the first place. class () => Diagnostic a defaultDiagnosticOpts :: Diagnostic a => DiagnosticOpts a -- | A collection of messages emitted by GHC during error reporting. A -- diagnostic message is typically a warning or an error. See Note -- [Messages]. -- -- INVARIANT: All the messages in this collection must be -- relevant, i.e. their Severity should not be -- SevIgnore. The smart constructor mkMessages will filter -- out any message which Severity is SevIgnore. data () => Messages e data () => Logger data () => StrictnessMark -- | Arguments in an expression/type after splitting data () => HsArg tm ty HsValArg :: tm -> HsArg tm ty -- | Haskell Type data () => HsType pass -- | HsForAllTy :: XForAllTy pass -> HsForAllTelescope pass -> LHsType pass -> HsType pass HsQualTy :: XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass -- | HsTyVar :: XTyVar pass -> PromotionFlag -> LIdP pass -> HsType pass -- | HsAppTy :: XAppTy pass -> LHsType pass -> LHsType pass -> HsType pass -- | HsWildCardTy :: XWildCardTy pass -> HsType pass -- | Haskell Type Variable Binder The flag annotates the binder. It is -- Specificity in places where explicit specificity is allowed -- (e.g. x :: forall {a} b. ...) or () in other places. data () => HsTyVarBndr flag pass UserTyVar :: XUserTyVar pass -> flag -> LIdP pass -> HsTyVarBndr flag pass -- | A type signature that obeys the forall-or-nothing rule. In -- other words, an LHsType that uses an -- HsOuterSigTyVarBndrs to represent its outermost type variable -- quantification. See Note [Representing type signatures]. data () => HsSigType pass HsSig :: XHsSig pass -> HsOuterSigTyVarBndrs pass -> LHsType pass -> HsSigType pass -- | Haskell Wildcard Binders data () => HsWildCardBndrs pass thing HsWC :: XHsWC pass thing -> thing -> HsWildCardBndrs pass thing -- | The outermost type variables in a type that obeys the -- forall-or-nothing rule. See Note [forall-or-nothing -- rule]. data () => HsOuterTyVarBndrs flag pass -- | Implicit forall, e.g., f :: a -> b -> b HsOuterImplicit :: XHsOuterImplicit pass -> HsOuterTyVarBndrs flag pass -- | Located Haskell Type type LHsType pass = XRec pass HsType pass -- | Fixity Signature data () => FixitySig pass FixitySig :: XFixitySig pass -> [LIdP pass] -> Fixity -> FixitySig 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 -> [LIdP pass] -> LHsSigWcType pass -> Sig pass -- | An ordinary fixity declaration -- --
--   infixl 8 ***
--   
-- -- FixSig :: XFixSig pass -> FixitySig pass -> Sig pass -- | An inline pragma -- --
--   {#- INLINE f #-}
--   
-- -- InlineSig :: XInlineSig pass -> LIdP pass -> InlinePragma -> Sig pass -- | A Haskell Declaration data () => HsDecl p -- | Signature declaration SigD :: XSigD p -> Sig p -> HsDecl p type LHsDecl p = XRec p HsDecl p -- | Haskell Module -- -- All we actually declare here is the top-level structure for a module. data () => HsModule p -- | Case alternatives where binders are CoreBndrs type CoreAlt = Alt CoreBndr -- | Binding groups where binders are CoreBndrs type CoreBind = Bind CoreBndr -- | Argument expressions where binders are CoreBndrs type CoreArg = Arg CoreBndr type CoreProgram = [CoreBind] -- | 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 GHC.Core.Unfold data () => Unfolding DFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding -- | 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 -> UnfoldingCache -> UnfoldingGuidance -> Unfolding -- | 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 -- | 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 -- | A Reduction is the result of an operation that rewrites a type -- ty_in. The Reduction includes the rewritten type -- ty_out and a Coercion co such that co :: -- ty_in ~ ty_out, where the role of the coercion is determined by -- the context. That is, the LHS type of the coercion is the original -- type ty_in, while its RHS type is the rewritten type -- ty_out. -- -- A Reduction is always homogeneous, unless it is wrapped inside a -- HetReduction, which separately stores the kind coercion. -- -- See Note [The Reduction type]. data () => Reduction Reduction :: Coercion -> !Type -> Reduction -- | Constant applicative form Information -- -- Records whether an Id makes Constant Applicative Form -- references data () => CafInfo -- | A function or static constructor that refers to no CAFs. NoCafRefs :: CafInfo data () => FamInstEnv type FamInstEnvs = (FamInstEnv, FamInstEnv) data () => FamFlavor DataFamilyInst :: TyCon -> FamFlavor data () => FamInst FamInst :: CoAxiom Unbranched -> FamFlavor -> Name -> [RoughMatchTc] -> [TyVar] -> [CoVar] -> [Type] -> Type -> FamInst data () => IfaceAnnotation -- | What to do in the link step, if there is one. data () => GhcLink -- | Use the in-memory dynamic linker (works for both bytecode and object -- code). LinkInMemory :: GhcLink data () => TcEvBinds EvBinds :: Bag EvBind -> TcEvBinds -- | 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 -- | The result of searching for an imported module. -- -- NB: FindResult manages both user source-import lookups (which can -- result in GenModule) as well as direct imports for interfaces -- (which always result in InstalledModule). data () => FindResult -- | The module was found Found :: ModLocation -> Module -> FindResult -- | The requested unit was not found NoPackage :: Unit -> FindResult -- | _Error_: both in multiple packages FoundMultiple :: [(Module, ModuleOrigin)] -> FindResult -- | Not found NotFound :: [FilePath] -> Maybe Unit -> [Unit] -> [Unit] -> [(Unit, UnusableUnitReason)] -> [ModuleSuggestion] -> FindResult -- | 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 -- | 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. -- -- See Note [Strictness in ModIface] to learn about why some fields are -- strict and others are not. data () => ModIface_ (phase :: ModIfacePhase) -- | Information about other packages that we have slurped in by reading -- their interface files data () => ExternalPackageState -- | Information about the currently loaded external packages. This is -- mutable because packages will be demand-loaded during a compilation -- run as required. data () => ExternalUnitCache -- | Helps us find information about modules in the home package type HomePackageTable = DModuleNameEnv HomeModInfo -- | Information about modules in the package being compiled data () => HomeModInfo data () => UnitEnv -- | Data for a module node in a ModuleGraph. Module nodes of the -- module graph are one of: -- -- data () => ModSummary -- | 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 -- | 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 data () => WhereFrom ImportBySystem :: WhereFrom -- | Historical "type-checking monad" (now it's just TcRn). type TcM = TcRn type TcRn = TcRnIf TcGblEnv TcLclEnv -- | Command line options gathered from the -PModule.Name:stuff syntax are -- given to you as this type type CommandLineOption = String -- | Desugaring monad. See also TcM. type DsM = TcRnIf DsGblEnv DsLclEnv -- | How should we choose which constraints to quantify over? data () => InferMode -- | Quantify over any constraint that satisfies pickQuantifiablePreds NoRestrictions :: InferMode -- | 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 -- | The result of successful typechecking. It also contains the parser -- result. data () => TypecheckedModule -- | The result of successful parsing. data () => ParsedModule -- | A newtype wrapper around a Module which: -- -- data StableModule -- | Abstraction of EpaComment. data ApiComment ApiLineComment :: String -> ApiComment ApiBlockComment :: String -> ApiComment pattern ManyTy :: Mult space :: IsLine doc => doc comma :: IsLine doc => doc colon :: IsLine doc => doc int :: IsLine doc => Int -> doc word :: Integer -> SDoc integer :: IsLine doc => Integer -> doc float :: IsLine doc => Float -> doc double :: IsLine doc => Double -> doc quote :: SDoc -> SDoc -- | Is this a type-level (i.e., computationally irrelevant, thus erasable) -- variable? Satisfies isTyVar = not . isId. isTyVar :: Var -> Bool rational :: Rational -> SDoc -- | Lift a computation from the IO monad. This allows us to run IO -- computations in any monadic stack, so long as it supports these kinds -- of operations (i.e. IO is the base monad for the stack). -- --

Example

-- --
--   import Control.Monad.Trans.State -- from the "transformers" library
--   
--   printState :: Show s => StateT s IO ()
--   printState = do
--     state <- get
--     liftIO $ print state
--   
-- -- Had we omitted liftIO, we would have ended up with -- this error: -- --
--   • Couldn't match type ‘IO’ with ‘StateT s IO’
--    Expected type: StateT s IO ()
--      Actual type: IO ()
--   
-- -- The important part here is the mismatch between StateT s IO -- () and IO (). -- -- Luckily, we know of a function that takes an IO a and -- returns an (m a): liftIO, enabling us to run -- the program and see the expected results: -- --
--   > evalStateT printState "hello"
--   "hello"
--   
--   > evalStateT printState 3
--   3
--   
liftIO :: MonadIO m => IO a -> m a getEnv :: IOEnv env env -- | Gives the filename of the RealSrcLoc srcLocFile :: RealSrcLoc -> FastString parens :: IsLine doc => doc -> doc -- | Module name (e.g. A.B.C) moduleName :: GenModule unit -> ModuleName -- | Unit the module belongs to moduleUnit :: GenModule unit -> unit mkFunTy :: HasDebugCallStack => FunTyFlag -> Mult -> Type -> Type -> Type infixr 3 `mkFunTy` -- | 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]) newUnique :: TcRnIf gbl lcl Unique isEmpty :: SDocContext -> SDoc -> Bool -- | Construct an expression which represents the application of a number -- of expressions to another. The leftmost expression in the list is -- applied first mkCoreApps :: CoreExpr -> [CoreExpr] -> CoreExpr infixl 4 `mkCoreApps` -- | Construct an expression which represents the application of a number -- of expressions to that of a data constructor expression. The leftmost -- expression in the list is applied first mkCoreConApps :: DataCon -> [CoreExpr] -> CoreExpr -- | Create a lambda where the given expression has a number of variables -- bound over it. The leftmost binder is that bound by the outermost -- lambda in the result mkCoreLams :: [CoreBndr] -> CoreExpr -> CoreExpr -- | Bind a list of binding groups over an expression. The leftmost binding -- group becomes the outermost group in the resulting expression mkCoreLets :: [CoreBind] -> CoreExpr -> CoreExpr -- | 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 simplifyInfer :: TcLevel -> InferMode -> [TcIdSigInst] -> [(Name, TcTauType)] -> WantedConstraints -> TcM ([TcTyVar], [EvVar], TcEvBinds, Bool) -- | Panics and asserts. panic :: HasCallStack => String -> a -- | Gives the Modified UTF-8 encoded bytes corresponding to a -- FastString bytesFS :: FastString -> ByteString -- | Create a FastString by copying an existing ByteString mkFastStringByteString :: ByteString -> FastString -- | Creates a UTF-8 encoded FastString from a String mkFastString :: String -> FastString -- | Lazily unpacks and decodes the FastString unpackFS :: FastString -> String concatFS :: [FastString] -> FastString -- | Wrap an unboxed address into a PtrString. mkPtrString# :: Addr# -> PtrString fsLit :: String -> FastString ptext :: PtrString -> SDoc semi :: IsLine doc => doc equals :: IsLine doc => doc lparen :: IsLine doc => doc rparen :: IsLine doc => doc lbrack :: IsLine doc => doc rbrack :: IsLine doc => doc lbrace :: IsLine doc => doc rbrace :: IsLine doc => doc quotes :: SDoc -> SDoc doubleQuotes :: IsLine doc => doc -> doc brackets :: IsLine doc => doc -> doc braces :: IsLine doc => doc -> doc -- | Indent SDoc some specified amount nest :: Int -> SDoc -> SDoc hang :: SDoc -> Int -> SDoc -> SDoc -- | This behaves like hang, but does not indent the second document -- when the header is empty. hangNotEmpty :: SDoc -> Int -> SDoc -> SDoc punctuate :: IsLine doc => doc -> [doc] -> [doc] -- | Join two SDoc together vertically ($+$) :: SDoc -> SDoc -> SDoc -- | A paragraph-fill combinator. It's much like sep, only it keeps fitting -- things on one line until it can't fit any more. cat :: [SDoc] -> SDoc -- | This behaves like fsep, but it uses <> for -- horizontal composition rather than <+> fcat :: [SDoc] -> SDoc -- | Used when constructing a term with an unused extension point. noExtField :: NoExtField moduleNameFS :: ModuleName -> FastString moduleNameString :: ModuleName -> String mkModuleName :: String -> ModuleName mkModuleNameFS :: FastString -> ModuleName mkVarOccFS :: FastString -> OccName isListEmptyOrSingleton :: [a] -> IsEmptyOrSingleton reallyAlwaysQualifyNames :: QueryQualifyName -- | NB: This won't ever show package IDs alwaysQualifyNames :: QueryQualifyName neverQualifyNames :: QueryQualifyName alwaysQualifyModules :: QueryQualifyModule neverQualifyModules :: QueryQualifyModule alwaysQualifyPackages :: QueryQualifyPackage neverQualifyPackages :: QueryQualifyPackage alwaysPrintPromTick :: QueryPromotionTick reallyAlwaysQualify :: NamePprCtx alwaysQualify :: NamePprCtx neverQualify :: NamePprCtx defaultUserStyle :: PprStyle defaultDumpStyle :: PprStyle mkDumpStyle :: NamePprCtx -> PprStyle -- | Default style for error messages, when we don't know NamePprCtx It's a -- bit of a hack because it doesn't take into account what's in scope -- Only used for desugarer warnings, and typechecker errors in interface -- sigs defaultErrStyle :: PprStyle -- | Style for printing error messages mkErrStyle :: NamePprCtx -> PprStyle cmdlineParserStyle :: PprStyle mkUserStyle :: NamePprCtx -> Depth -> PprStyle withUserStyle :: NamePprCtx -> Depth -> SDoc -> SDoc withErrStyle :: NamePprCtx -> SDoc -> SDoc setStyleColoured :: Bool -> PprStyle -> PprStyle runSDoc :: SDoc -> SDocContext -> Doc -- | Default pretty-printing options defaultSDocContext :: SDocContext traceSDocContext :: SDocContext withPprStyle :: PprStyle -> SDoc -> SDoc pprDeeper :: SDoc -> SDoc -- | Truncate a list that is longer than the current depth. pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc pprSetDepth :: Depth -> SDoc -> SDoc getPprStyle :: (PprStyle -> SDoc) -> SDoc sdocWithContext :: (SDocContext -> SDoc) -> SDoc sdocOption :: (SDocContext -> a) -> (a -> SDoc) -> SDoc updSDocContext :: (SDocContext -> SDocContext) -> SDoc -> SDoc qualName :: PprStyle -> QueryQualifyName qualModule :: PprStyle -> QueryQualifyModule qualPackage :: PprStyle -> QueryQualifyPackage promTick :: PprStyle -> QueryPromotionTick queryQual :: PprStyle -> NamePprCtx codeStyle :: PprStyle -> Bool dumpStyle :: PprStyle -> Bool userStyle :: PprStyle -> Bool -- | Indicate if -dppr-debug mode is enabled getPprDebug :: IsOutput doc => (Bool -> doc) -> doc -- | Says what to do with and without -dppr-debug ifPprDebug :: IsOutput doc => doc -> doc -> doc -- | Says what to do with -dppr-debug; without, return empty whenPprDebug :: IsOutput doc => doc -> doc -- | The analog of printDoc_ for SDoc, which tries to make -- sure the terminal doesn't get screwed up by the ANSI color codes if an -- exception is thrown during pretty-printing. printSDoc :: SDocContext -> Mode -> Handle -> SDoc -> IO () -- | Like printSDoc but appends an extra newline. printSDocLn :: SDocContext -> Mode -> Handle -> SDoc -> IO () -- | An efficient variant of printSDoc specialized for -- LeftMode that outputs to a BufHandle. bufLeftRenderSDoc :: SDocContext -> BufHandle -> SDoc -> IO () pprCode :: SDoc -> SDoc renderWithContext :: SDocContext -> SDoc -> String showSDocOneLine :: SDocContext -> SDoc -> String showSDocUnsafe :: SDoc -> String showPprUnsafe :: Outputable a => a -> String pprDebugAndThen :: SDocContext -> (String -> a) -> SDoc -> SDoc -> a docToSDoc :: Doc -> SDoc -- | doublePrec p n shows a floating point number n with -- p digits of precision after the decimal point. doublePrec :: Int -> Double -> SDoc angleBrackets :: IsLine doc => doc -> doc cparen :: Bool -> SDoc -> SDoc blankLine :: SDoc dcolon :: SDoc arrow :: SDoc lollipop :: SDoc larrow :: SDoc darrow :: SDoc arrowt :: SDoc larrowt :: SDoc arrowtt :: SDoc larrowtt :: SDoc lambda :: SDoc underscore :: IsLine doc => doc dot :: IsLine doc => doc vbar :: IsLine doc => doc forAllLit :: SDoc bullet :: SDoc unicodeSyntax :: SDoc -> SDoc -> SDoc ppWhen :: IsOutput doc => Bool -> doc -> doc ppUnless :: IsOutput doc => Bool -> doc -> doc ppWhenOption :: (SDocContext -> Bool) -> SDoc -> SDoc ppUnlessOption :: IsLine doc => (SDocContext -> Bool) -> doc -> doc -- | Apply the given colour/style for the argument. -- -- Only takes effect if colours are enabled. coloured :: PprColour -> SDoc -> SDoc keyword :: SDoc -> SDoc pprModuleName :: IsLine doc => ModuleName -> doc -- | Special combinator for showing character literals. pprHsChar :: Char -> SDoc -- | Special combinator for showing string literals. pprHsString :: FastString -> SDoc -- | Special combinator for showing bytestring literals. pprHsBytes :: ByteString -> SDoc primCharSuffix :: SDoc primFloatSuffix :: SDoc primIntSuffix :: SDoc primDoubleSuffix :: SDoc primWordSuffix :: SDoc primInt8Suffix :: SDoc primWord8Suffix :: SDoc primInt16Suffix :: SDoc primWord16Suffix :: SDoc primInt32Suffix :: SDoc primWord32Suffix :: SDoc primInt64Suffix :: SDoc primWord64Suffix :: SDoc -- | Special combinator for showing unboxed literals. pprPrimChar :: Char -> SDoc pprPrimInt :: Integer -> SDoc pprPrimWord :: Integer -> SDoc pprPrimInt8 :: Integer -> SDoc pprPrimInt16 :: Integer -> SDoc pprPrimInt32 :: Integer -> SDoc pprPrimInt64 :: Integer -> SDoc pprPrimWord8 :: Integer -> SDoc pprPrimWord16 :: Integer -> SDoc pprPrimWord32 :: Integer -> SDoc pprPrimWord64 :: Integer -> SDoc pprPrefixVar :: Bool -> SDoc -> SDoc pprInfixVar :: Bool -> SDoc -> SDoc pprFastFilePath :: FastString -> SDoc -- | Normalise, escape and render a string representing a path -- -- e.g. "c:\whatever" pprFilePathString :: IsLine doc => FilePath -> doc pprWithCommas :: (a -> SDoc) -> [a] -> SDoc pprWithBars :: (a -> SDoc) -> [a] -> SDoc spaceIfSingleQuote :: SDoc -> SDoc -- | Returns the separated concatenation of the pretty printed things. interppSP :: Outputable a => [a] -> SDoc -- | Returns the comma-separated concatenation of the pretty printed -- things. interpp'SP :: Outputable a => [a] -> SDoc interpp'SP' :: (a -> SDoc) -> [a] -> SDoc -- | Returns the comma-separated concatenation of the quoted pretty printed -- things. -- --
--   [x,y,z]  ==>  `x', `y', `z'
--   
pprQuotedList :: Outputable a => [a] -> SDoc quotedListWithOr :: [SDoc] -> SDoc quotedListWithNor :: [SDoc] -> SDoc intWithCommas :: Integral a => a -> SDoc -- | Converts an integer to a verbal index: -- --
--   speakNth 1 = text "first"
--   speakNth 5 = text "fifth"
--   speakNth 21 = text "21st"
--   
speakNth :: Int -> SDoc -- | Converts an integer to a verbal multiplicity: -- --
--   speakN 0 = text "none"
--   speakN 5 = text "five"
--   speakN 10 = text "10"
--   
speakN :: Int -> SDoc -- | Converts an integer and object description to a statement about the -- multiplicity of those objects: -- --
--   speakNOf 0 (text "melon") = text "no melons"
--   speakNOf 1 (text "melon") = text "one melon"
--   speakNOf 3 (text "melon") = text "three melons"
--   
speakNOf :: Int -> SDoc -> SDoc -- | Determines the pluralisation suffix appropriate for the length of a -- list: -- --
--   plural [] = char 's'
--   plural ["Hello"] = empty
--   plural ["Hello", "World"] = char 's'
--   
plural :: [a] -> SDoc -- | Determines the singular verb suffix appropriate for the length of a -- list: -- --
--   singular [] = empty
--   singular["Hello"] = char 's'
--   singular ["Hello", "World"] = empty
--   
singular :: [a] -> SDoc -- | Determines the form of to be appropriate for the length of a list: -- --
--   isOrAre [] = text "are"
--   isOrAre ["Hello"] = text "is"
--   isOrAre ["Hello", "World"] = text "are"
--   
isOrAre :: [a] -> SDoc -- | Determines the form of to do appropriate for the length of a list: -- --
--   doOrDoes [] = text "do"
--   doOrDoes ["Hello"] = text "does"
--   doOrDoes ["Hello", "World"] = text "do"
--   
doOrDoes :: [a] -> SDoc -- | Determines the form of possessive appropriate for the length of a -- list: -- --
--   itsOrTheir [x]   = text "its"
--   itsOrTheir [x,y] = text "their"
--   itsOrTheir []    = text "their"  -- probably avoid this
--   
itsOrTheir :: [a] -> SDoc -- | Determines the form of subject appropriate for the length of a list: -- --
--   thisOrThese [x]   = text "This"
--   thisOrThese [x,y] = text "These"
--   thisOrThese []    = text "These"  -- probably avoid this
--   
thisOrThese :: [a] -> SDoc -- | "has" or "have" depending on the length of a list. hasOrHave :: [a] -> SDoc bPutHDoc :: BufHandle -> SDocContext -> HDoc -> IO () throwGhcException :: GhcException -> a throwGhcExceptionIO :: GhcException -> IO a -- | Basic IdInfo that carries no useful information whatsoever vanillaIdInfo :: IdInfo emptyPlugins :: Plugins getKey :: Unique -> Int mkUnique :: Char -> Int -> Unique hasKey :: Uniquable a => a -> Unique -> Bool nameOccName :: Name -> OccName -- | 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 mkSrcLoc :: FastString -> Int -> Int -> SrcLoc mkRealSrcLoc :: FastString -> Int -> Int -> RealSrcLoc -- | Raises an error when used on a "bad" RealSrcLoc srcLocLine :: RealSrcLoc -> Int -- | Raises an error when used on a "bad" RealSrcLoc srcLocCol :: RealSrcLoc -> Int -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty noSrcSpan :: SrcSpan -- | Create a "bad" SrcSpan that has not location information mkGeneralSrcSpan :: FastString -> SrcSpan -- | Create a SrcSpan between two points in a file mkRealSrcSpan :: RealSrcLoc -> RealSrcLoc -> RealSrcSpan -- | Create a SrcSpan between two points in a file mkSrcSpan :: SrcLoc -> SrcLoc -> 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 -- | Test if a SrcSpan is "good", i.e. has precise location -- information isGoodSrcSpan :: SrcSpan -> Bool srcSpanStartLine :: RealSrcSpan -> Int srcSpanEndLine :: RealSrcSpan -> Int srcSpanStartCol :: RealSrcSpan -> Int srcSpanEndCol :: RealSrcSpan -> Int realSrcSpanStart :: RealSrcSpan -> RealSrcLoc -- | Obtains the filename for a SrcSpan if it is "good" srcSpanFileName_maybe :: SrcSpan -> Maybe FastString srcSpanToRealSrcSpan :: SrcSpan -> Maybe RealSrcSpan unLoc :: GenLocated l e -> e mkUniqSet :: Uniquable a => [a] -> UniqSet a mkIntegralLit :: Integral a => a -> IntegralLit mkTHFractionalLit :: Rational -> FractionalLit bagToList :: Bag a -> [a] -- | Create a new simple unit identifier from a FastString. -- Internally, this is primarily used to specify wired-in unit -- identifiers. fsToUnit :: FastString -> Unit unitString :: IsUnitId u => u -> String -- | Return the UnitId of the Unit. For on-the-fly instantiated units, -- return the UnitId of the indefinite unit this unit is an instance of. toUnitId :: Unit -> UnitId -- | Get a string representation of a GenModule that's unique and -- stable across recompilations. eg. -- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal" moduleStableString :: Module -> String topPrec :: PprPrec funPrec :: PprPrec noOccInfo :: OccInfo isStrongLoopBreaker :: OccInfo -> Bool isDeadOcc :: OccInfo -> Bool -- | 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 -- | 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) with linearity annotations -- -- 6) The original result type of the DataCon dataConFullSig :: DataCon -> ([TyVar], [TyCoVar], [EqSpec], ThetaType, [Scaled Type], Type) -- | The labels for the fields of this particular DataCon dataConFieldLabels :: DataCon -> [FieldLabel] -- | The existentially-quantified type/coercion variables of the -- constructor including dependent (kind-) GADT equalities dataConExTyCoVars :: DataCon -> [TyCoVar] -- | The type constructor that we are building via this data constructor dataConTyCon :: DataCon -> TyCon -- | 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 Name of the DataCon, giving it a unique, rooted -- identification dataConName :: DataCon -> Name tupleTyCon :: Boxity -> Arity -> TyCon tupleDataCon :: Boxity -> Arity -> DataCon naturalTy :: Type liftedTypeKind :: Type typeSymbolKind :: Kind listTyCon :: TyCon mkVarOcc :: String -> OccName mkTyVarOcc :: String -> OccName mkTcOcc :: String -> OccName occNameString :: OccName -> String nameSrcLoc :: Name -> SrcLoc nameSrcSpan :: Name -> SrcSpan isExternalName :: Name -> Bool isInternalName :: Name -> Bool nameModule :: HasDebugCallStack => Name -> Module nameModule_maybe :: Name -> Maybe Module isSystemName :: Name -> Bool -- | Create a name which is (for now at least) local to the current module -- and hence does not need a GenModule to disambiguate it from -- other Names mkInternalName :: Unique -> OccName -> SrcSpan -> Name -- | Create a name brought into being by the compiler mkSystemName :: Unique -> OccName -> Name -- | Compare Names lexicographically This only works for Names that -- originate in the source code or have been tidied. stableNameCmp :: Name -> Name -> Ordering -- | 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 getSrcSpan :: NamedThing a => a -> SrcSpan getOccString :: NamedThing a => a -> String varUnique :: Var -> Unique setVarUnique :: Var -> Unique -> Var setVarName :: Var -> Name -> Var setVarType :: Var -> Type -> Var binderVar :: VarBndr tv argf -> tv tyVarKind :: TyVar -> Kind mkTyVar :: Name -> Kind -> TyVar idInfo :: HasDebugCallStack => Id -> IdInfo idDetails :: Id -> IdDetails mkLocalVar :: IdDetails -> Name -> Mult -> Type -> IdInfo -> Id -- | Is this a value-level (i.e., computationally relevant) -- Varentifier? Satisfies isId = not . isTyVar. isId :: Var -> Bool -- | Is this a coercion variable? Satisfies isId v ==> -- isCoVar v == not (isNonCoVarId v). isCoVar :: Var -> Bool isLocalId :: Var -> Bool -- | The same as fst . splitTyConApp We can short-cut the FunTy -- case tyConAppTyCon_maybe :: Type -> Maybe TyCon -- | 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]) -- | 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 emptyVarSet :: VarSet unitVarSet :: Var -> VarSet extendVarSet :: VarSet -> Var -> VarSet extendVarSetList :: VarSet -> [Var] -> VarSet elemVarSet :: Var -> VarSet -> Bool emptyInScopeSet :: InScopeSet mkRnEnv2 :: InScopeSet -> RnEnv2 -- | All names made available by the availability information (excluding -- overloaded selectors) availNames :: AvailInfo -> [Name] -- | A Name for internal use, but not for output to the user. For -- fields, the OccName will be the selector. See Note [GreNames] -- in GHC.Types.Name.Reader. greNameMangledName :: GreName -> Name mkUnqual :: NameSpace -> FastString -> RdrName mkVarUnqual :: FastString -> 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 getRdrName :: NamedThing thing => thing -> RdrName nameRdrName :: Name -> RdrName -- | 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] -- | A Name for the GRE for internal use. Careful: the -- OccName of this Name is not necessarily the same as the -- greOccName (see Note [GreNames]). greMangledName :: GlobalRdrElt -> Name globalRdrEnvElts :: GlobalRdrEnv -> [GlobalRdrElt] -- | Look for this RdrName in the global environment. Omits record -- fields without selector functions (see Note [NoFieldSelectors] in -- GHC.Rename.Env). lookupGRE_RdrName :: RdrName -> GlobalRdrEnv -> [GlobalRdrElt] mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv getLocA :: GenLocated (SrcSpanAnn' a) e -> SrcSpan noLocA :: a -> LocatedAn an a noAnnSrcSpan :: SrcSpan -> SrcAnn ann -- | Short form for EpAnnNotUsed noAnn :: EpAnn a -- | Module name. ideclName :: ImportDecl pass -> XRec pass ModuleName -- | as Module ideclAs :: ImportDecl pass -> Maybe (XRec pass ModuleName) itName :: Unique -> SrcSpan -> Name dATA_FOLDABLE :: Module gHC_REAL :: Module ge_RDR :: RdrName le_RDR :: RdrName lt_RDR :: RdrName gt_RDR :: RdrName minus_RDR :: RdrName times_RDR :: RdrName plus_RDR :: RdrName and_RDR :: RdrName not_RDR :: RdrName varQual_RDR :: Module -> FastString -> RdrName eqClassName :: Name ordClassName :: Name bindMName :: Name negateName :: Name isStringClassName :: Name eqClassKey :: Unique fractionalClassKey :: Unique ordClassKey :: Unique dollarIdKey :: Unique numericClassKeys :: [Unique] fractionalClassKeys :: [Unique] -- | Find the annotations attached to the given target as Typeable -- values of your choice. If no deserializer is specified, only transient -- annotations will be returned. findAnns :: Typeable a => ([Word8] -> a) -> AnnEnv -> CoreAnnTarget -> [a] coAxiomTyCon :: forall (br :: BranchFlag). CoAxiom br -> TyCon -- | If it is the case that -- --
--   c :: (t1 ~ t2)
--   
-- -- i.e. the kind of c relates t1 and t2, then -- coercionKind c = Pair t1 t2. coercionKind :: Coercion -> Pair Type classAllSelIds :: Class -> [Id] classSCSelIds :: Class -> [Id] classMethods :: Class -> [Id] classSCTheta :: Class -> [PredType] classBigSig :: Class -> ([TyVar], [PredType], [Id], [ClassOpItem]) -- | Create an primitive TyCon, such as Int#, Type -- or RealWorld# Primitive TyCons are marshalable iff not -- lifted. If you'd like to change this, modify marshalablePrimTyCon. mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon -- | Does this TyCon represent something that cannot be defined in -- Haskell? isPrimTyCon :: TyCon -> Bool -- | Returns True if the supplied TyCon resulted from -- either a data or newtype declaration isAlgTyCon :: TyCon -> Bool -- | Returns True for vanilla AlgTyCons -- that is, those created -- with a data or newtype declaration. isVanillaAlgTyCon :: TyCon -> Bool -- | Is this TyCon that for a newtype isNewTyCon :: TyCon -> Bool -- | Is this a TyCon representing a regular H98 type synonym -- (type)? isTypeSynonymTyCon :: TyCon -> Bool -- | Is this an algebraic TyCon declared with the GADT syntax? isGadtSyntaxTyCon :: TyCon -> Bool -- | Is this a TyCon, synonym or otherwise, that defines a family? isFamilyTyCon :: TyCon -> Bool -- | Is this the TyCon for a boxed tuple? isBoxedTupleTyCon :: TyCon -> Bool -- | Is this a PromotedDataCon? isPromotedDataCon :: TyCon -> Bool -- | As tyConDataCons_maybe, but returns the empty list of -- constructors if no constructors could be found tyConDataCons :: TyCon -> [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] -- | 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. tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon -- | 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) -- | Extract the TyVars bound by a vanilla type synonym and the -- corresponding (unsubstituted) right hand side. synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type) -- | Extract the information pertaining to the right hand side of a type -- synonym (type) declaration. synTyConRhs_maybe :: TyCon -> Maybe Type -- | Is this TyCon that for a class instance? isClassTyCon :: TyCon -> Bool -- | 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 data family instance? isFamInstTyCon :: TyCon -> Bool -- | 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]) mkTyVarTy :: TyVar -> Type mkTyVarTys :: [TyVar] -> [Type] -- | Wraps foralls over the type using the provided TyCoVars from -- left to right mkForAllTys :: [ForAllTyBinder] -> Type -> Type primTyCons :: [TyCon] isArrowTyCon :: TyCon -> Bool eqPrimTyCon :: TyCon eqReprPrimTyCon :: TyCon emptyTvSubstEnv :: TvSubstEnv emptySubst :: Subst -- | Add a substitution from a CoVar to a Coercion to the -- Subst: you must ensure that the in-scope set satisfies Note -- [The substitution invariant] after extending the substitution like -- this extendCvSubst :: Subst -> CoVar -> Coercion -> Subst -- | Generates the in-scope set for the TCvSubst from the types in -- the incoming environment. No CoVars, please! The InScopeSet is just a -- thunk so with a bit of luck it'll never be evaluated mkTvSubstPrs :: [(TyVar, Type)] -> Subst -- | Type substitution, see zipTvSubst substTyWith :: HasDebugCallStack => [TyVar] -> [Type] -> Type -> Type -- | Substitute within a Type The substitution has to satisfy the -- invariants described in Note [The substitution invariant]. substTy :: HasDebugCallStack => Subst -> Type -> Type isTyVarTy :: Type -> Bool -- | 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 extract the multiplicity, argument and result types from a -- type splitFunTy_maybe :: Type -> Maybe (FunTyFlag, Mult, Type, Type) splitFunTys :: Type -> ([Scaled 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 -- | The same as snd . splitTyConApp tyConAppArgs_maybe :: Type -> Maybe [Type] -- | 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 -- | 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. splitForAllTyCoVars :: Type -> ([TyCoVar], Type) -- | Is this a function? isFunTy :: Type -> Bool -- | Drops all ForAllTys dropForAlls :: Type -> Type -- | Does this classify a type allowed to have values? Responds True to -- things like *, TYPE Lifted, TYPE IntRep, TYPE v, Constraint. -- -- True of a kind `TYPE _` or `CONSTRAINT _` isTYPEorCONSTRAINT :: Kind -> Bool irrelevantMult :: Scaled a -> a -- | Type equality on source types. Does not look through -- newtypes, PredTypes or type families, 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 -- GHC.Core.TyCo.Rep. eqType :: Type -> Type -> Bool nonDetCmpType :: Type -> Type -> Ordering -- | Find the Haskell Type the literal occupies literalType :: Literal -> Type -- | Make a representational reflexive coercion mkRepReflCo :: Type -> Coercion -- | Create an error DiagnosticMessage holding just a single -- SDoc mkPlainError :: [GhcHint] -> SDoc -> DiagnosticMessage -- | Are there any errors or -Werror warnings here? errorsOrFatalWarningsFound :: Messages e -> Bool getLogger :: HasLogger m => m Logger -- | Log something putLogMsg :: Logger -> LogAction pprLocMsgEnvelope :: Diagnostic e => DiagnosticOpts e -> MsgEnvelope e -> SDoc -- | 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 => Logger -> SDoc -> (a -> ()) -> m a -> m a -- | The ByteCode interpreter. -- -- Produce ByteCode objects (BCO, see GHC.ByteCode) that can be -- interpreted. It is used by GHCi. -- -- Currently some extensions are not supported (foreign primops). -- -- See GHC.StgToByteCode interpreterBackend :: Backend -- | This one is called from the expression matcher, which already has a -- MatchEnv in hand ruleMatchTyKiX :: TyCoVarSet -> RnEnv2 -> TvSubstEnv -> Type -> Type -> Maybe TvSubstEnv -- | Simple unification of two types; all type variables are bindable -- Precondition: the kinds are already equal tcUnifyTy :: Type -> Type -> Maybe Subst mkClassPred :: Class -> [Type] -> PredType getClassPredTys :: HasDebugCallStack => PredType -> (Class, [Type]) getClassPredTys_maybe :: PredType -> Maybe (Class, [Type]) isEvVarType :: Type -> Bool isClassPred :: PredType -> Bool isEqPred :: PredType -> Bool isEqPrimPred :: PredType -> Bool isDictId :: Id -> 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 universally-quantified type variables of the constructor dataConUnivTyVars :: DataCon -> [TyVar] -- | The *full* constraints on the constructor type, including dependent -- GADT equalities. dataConTheta :: DataCon -> ThetaType -- | 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 -- | Find all the Ids implicitly brought into scope by the data -- constructor. Currently, the union of the dataConWorkId and the -- dataConWrapId dataConImplicitTyThings :: DataCon -> [TyThing] -- | Give the demands on the arguments of a Core constructor application -- (Con dc args) dataConRepStrictness :: DataCon -> [StrictnessMark] -- | 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. dataConWrapperType :: 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] -> [Scaled Type] -- | Returns the argument types of the wrapper, excluding all dictionary -- arguments and without substituting for any type variables dataConOrigArgTys :: DataCon -> [Scaled Type] -- | 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 -> [Scaled Type] isTupleDataCon :: DataCon -> Bool -- | Vanilla DataCons are those that are nice boring Haskell 98 -- constructors isVanillaDataCon :: DataCon -> Bool classDataCon :: Class -> DataCon -- | Retrieves the template of an unfolding if possible -- maybeUnfoldingTemplate is used mainly when specialising, and we do -- want to specialise DFuns, so it's important to return a template for -- DFunUnfoldings maybeUnfoldingTemplate :: Unfolding -> Maybe CoreExpr cmpAlt :: Alt a -> Alt a -> Ordering -- | 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` -- | Apply a list of type argument expressions to a function expression in -- a nested fashion mkTyApps :: Expr b -> [Type] -> Expr b infixl 4 `mkTyApps` mkTyArg :: Type -> 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 -- | Extract every variable by this group bindersOf :: Bind b -> [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)] -- | 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) collectTyBinders :: CoreExpr -> ([TyVar], CoreExpr) collectTyAndValBinders :: CoreExpr -> ([TyVar], [Id], CoreExpr) -- | 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]) -- | Returns True iff the expression is a Type expression -- at its top level. Note this does NOT include Coercions. isTypeArg :: Expr b -> Bool -- | Id CAF info cafInfo :: IdInfo -> CafInfo setOccInfo :: IdInfo -> OccInfo -> IdInfo infixl 1 `setOccInfo` setCafInfo :: IdInfo -> CafInfo -> IdInfo infixl 1 `setCafInfo` mayHaveCafRefs :: CafInfo -> Bool idType :: Id -> Kind setIdInfo :: Id -> IdInfo -> Id modifyIdInfo :: HasDebugCallStack => (IdInfo -> IdInfo) -> Id -> 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 -- | Create a user local Id. These are local Ids (see -- GHC.Types.Var#globalvslocal) with a name and location that the -- user might recognize mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id isRecordSelector :: Id -> Bool isClassOpId_maybe :: Id -> Maybe Class isDFunId :: 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 -- | Expose the unfolding if there is one, including for loop breakers realIdUnfolding :: Id -> Unfolding idOccInfo :: Id -> OccInfo isConLikeId :: Id -> Bool intTyConName :: Name boolTyConName :: Name listTyConName :: Name anyTy :: Type true_RDR :: RdrName charTyCon :: TyCon charDataCon :: DataCon stringTy :: Type intTy :: Type intTyCon :: TyCon intDataCon :: DataCon boolTy :: Type boolTyCon :: TyCon falseDataCon :: DataCon trueDataCon :: DataCon falseDataConId :: Id trueDataConId :: Id nilDataCon :: DataCon consDataCon :: DataCon -- | Find all locally-defined free Ids or type variables in an expression -- returning a deterministically ordered list. exprFreeVarsList :: CoreExpr -> [Var] emptyFamInstEnv :: FamInstEnv famInstEnvElts :: FamInstEnv -> [FamInst] -- | Get rid of *outermost* (or toplevel) * type function redex * data -- family redex * newtypes returning an appropriate Representational -- coercion. Specifically, if topNormaliseType_maybe env ty = Just (co, -- ty') then (a) co :: ty ~R ty' (b) ty' is not a newtype, and is not a -- type-family or data-family redex -- -- However, ty' can be something like (Maybe (F ty)), where (F ty) is a -- redex. -- -- Always operates homogeneously: the returned type has the same kind as -- the original type, and the returned coercion is always homogeneous. topNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe Reduction -- | Recover the type of a well-typed Core expression. Fails when applied -- to the actual Type expression as it cannot really be said to -- have a type exprType :: HasDebugCallStack => CoreExpr -> Type -- | Add a substitution for an Id to the Subst: you must -- ensure that the in-scope set is such that TyCoSubst Note [The -- substitution invariant] holds after extending the substitution like -- this extendIdSubst :: Subst -> Id -> CoreExpr -> Subst -- | substExpr applies a substitution to an entire CoreExpr. -- Remember, you may only apply the substitution once: See Note -- [Substitutions apply only once] in GHC.Core.TyCo.Subst -- -- Do *not* attempt to short-cut in the case of an empty substitution! -- See Note [Extending the IdSubstEnv] substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr occurAnalysePgm :: Module -> (Id -> Bool) -> (Activation -> Bool) -> [CoreRule] -> CoreProgram -> CoreProgram pAT_ERROR_ID :: Id mkHsForAllInvisTele :: forall (p :: Pass). EpAnnForallTy -> [LHsTyVarBndr Specificity (GhcPass p)] -> HsForAllTelescope (GhcPass p) getDynFlags :: HasDynFlags m => m DynFlags -- | Test whether a GeneralFlag is set -- -- Note that dynamicNow (i.e., dynamic objects built with -- `-dynamic-too`) always implicitly enables Opt_PIC, -- Opt_ExternalDynamicRefs, and disables Opt_SplitSections. gopt :: GeneralFlag -> DynFlags -> Bool -- | Set a GeneralFlag gopt_set :: DynFlags -> GeneralFlag -> DynFlags -- | Set a Extension xopt_set :: DynFlags -> Extension -> DynFlags -- | Sets the DynFlags to be appropriate to the optimisation level updOptLevel :: Int -> DynFlags -> DynFlags tcSplitDFunTy :: Type -> ([TyVar], [Type], Class, [Type]) tcSplitMethodTy :: Type -> ([TyVar], PredType, Type) instanceDFunId :: ClsInst -> DFunId instanceSig :: ClsInst -> ([TyVar], [Type], Class, [Type]) instEnvElts :: InstEnv -> [ClsInst] -- | Show a SDoc as a String with the default user style showSDoc :: DynFlags -> SDoc -> String showPpr :: Outputable a => DynFlags -> a -> String failM :: IOEnv env a mkHsApp :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) mkHsLam :: forall (p :: Pass). (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ Origin) => [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) mkHsIntegral :: IntegralLit -> HsOverLit GhcPs mkHsFractional :: FractionalLit -> HsOverLit GhcPs nlHsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsExpr (GhcPass p) nlVarPat :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LPat (GhcPass p) nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs nlHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) nlHsTyVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p) nlHsFunTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) nlHsTyConApp :: forall (p :: Pass) a. IsSrcSpanAnn p a => PromotionFlag -> LexicalFixity -> IdP (GhcPass p) -> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p) -- | Convert an LHsType to an LHsSigType. hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs -- | Convert an LHsType to an LHsSigWcType. hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc -- | Extract a suitable CtOrigin from a HsExpr lexprCtOrigin :: LHsExpr GhcRn -> CtOrigin lookupHpt :: HomePackageTable -> ModuleName -> Maybe HomeModInfo ue_hpt :: HasDebugCallStack => UnitEnv -> HomePackageTable ms_mod_name :: ModSummary -> ModuleName mkTcRnUnknownMessage :: (Diagnostic a, Typeable a, DiagnosticOpts a ~ NoDiagnosticOpts) => a -> TcRnMessage srcErrorMessages :: SourceError -> Messages GhcMessage printMessages :: Diagnostic a => Logger -> DiagnosticOpts a -> DiagOpts -> Messages a -> IO () -- | Initialise the general configuration for printing diagnostic messages -- For example, this configuration controls things like whether warnings -- are treated like errors. initDiagOpts :: DynFlags -> DiagOpts initDsMessageOpts :: DynFlags -> DiagnosticOpts DsMessage getSession :: GhcMonad m => m HscEnv -- | Call the argument with the current session. withSession :: GhcMonad m => (HscEnv -> m a) -> m a purePlugin :: [CommandLineOption] -> IO PluginRecompile -- | Default plugin: does nothing at all, except for marking that safe -- inference has failed unless -fplugin-trustworthy is passed. -- For compatibility reason you should base all your plugin definitions -- on this default value. defaultPlugin :: Plugin -- | Locate a module that was imported by the user. We have the module's -- name, and possibly a package name. Without a package name, this -- function will use the search path and the known exposed packages to -- find the module, if a package is specified then only that package is -- searched for the module. findImportedModule :: HscEnv -> ModuleName -> PkgQual -> IO FindResult findExposedPackageModule :: FinderCache -> FinderOpts -> UnitState -> ModuleName -> PkgQual -> IO FindResult isNumericClass :: Class -> Bool cannotFindModule :: HscEnv -> ModuleName -> FindResult -> SDoc rnLExpr :: LHsExpr GhcPs -> RnM (LHsExpr GhcRn, FreeVars) tcInferRho :: LHsExpr GhcRn -> TcM (LHsExpr GhcTc, TcRhoType) addErrAt :: SrcSpan -> TcRnMessage -> TcRn () addErrs :: [(SrcSpan, TcRnMessage)] -> TcRn () reportDiagnostics :: [MsgEnvelope TcRnMessage] -> TcM () reportDiagnostic :: MsgEnvelope TcRnMessage -> TcRn () failIfErrsM :: TcRn () captureConstraints :: TcM a -> TcM (a, WantedConstraints) failWithTc :: TcRnMessage -> TcM a -- | Throw out any constraints emitted by the thing_inside discardConstraints :: TcM a -> TcM a pushTcLevelM :: TcM a -> TcM (TcLevel, a) -- | Run an IfG (top-level interface monad) computation inside an -- existing TcRn (typecheck-renaming monad) computation by -- initializing an IfGblEnv based on TcGblEnv. initIfaceTcRn :: IfG a -> TcRn a loadInterface :: SDoc -> Module -> WhereFrom -> IfM lcl (MaybeErr SDoc ModIface) -- | Run a DsM action inside the TcM monad. initDsTc :: DsM a -> TcM (Messages DsMessage, Maybe a) -- | Run a DsM action in the context of an existing ModGuts initDsWithModGuts :: HscEnv -> ModGuts -> DsM a -> IO (Messages DsMessage, Maybe a) -- | Replace the body of the function with this block to test the -- hsExprType function in GHC.Tc.Utils.Zonk: putSrcSpanDs loc $ do { -- core_expr <- dsExpr e ; massertPpr (exprType core_expr -- eqType hsExprType e) (ppr e + dcolon + ppr -- (hsExprType e) $$ ppr core_expr + dcolon + ppr (exprType -- core_expr)) ; return core_expr } dsLExpr :: LHsExpr GhcTc -> DsM CoreExpr zonkTopLExpr :: LHsExpr GhcTc -> TcM (LHsExpr GhcTc) captureTopConstraints :: TcM a -> TcM (a, WantedConstraints) simplifyInteractive :: WantedConstraints -> TcM (Bag EvBind) -- | Rename raw package imports renamePkgQual :: UnitEnv -> ModuleName -> Maybe FastString -> PkgQual tcValBinds :: TopLevelFlag -> [(RecFlag, LHsBinds GhcRn)] -> [LSig GhcRn] -> TcM thing -> TcM ([(RecFlag, LHsBinds GhcTc)], thing) tcInferSigma :: Bool -> LHsExpr GhcRn -> TcM TcSigmaType -- | ASSUMES that the module is either in the HomePackageTable or -- is a package module with an interface on disk. If neither of these is -- true, then the result will be an error indicating the interface could -- not be found. getModuleInterface :: HscEnv -> Module -> IO (Messages TcRnMessage, Maybe ModIface) hscTcRcLookupName :: HscEnv -> Name -> IO (Maybe TyThing) -- | Convert a typechecked module to Core hscDesugar :: HscEnv -> ModSummary -> TcGblEnv -> IO ModGuts compileFile :: HscEnv -> StopPhase -> (FilePath, Maybe Phase) -> IO (Maybe FilePath) modInfoTopLevelScope :: ModuleInfo -> Maybe [Name] isDictonaryId :: Id -> Bool -- | Put a Typeable value that we are able to actually turn into bytes into -- a Serialized value ready for deserialization later toSerialized :: Typeable a => (a -> [Word8]) -> a -> Serialized -- | If the Serialized value contains something of the given type, -- then use the specified deserializer to return Just that. -- Otherwise return Nothing. fromSerialized :: Typeable a => ([Word8] -> a) -> Serialized -> Maybe a -- | Use a Data instance to implement a deserialization scheme dual -- to that of serializeWithData deserializeWithData :: Data a => [Word8] -> a -- | Extract top-level comments from a module. apiComments :: ParsedModule -> [Located ApiComment] apiCommentsParsedSource :: Located (HsModule GhcPs) -> [Located ApiComment] dataConSig :: DataCon -> ([TyCoVar], ThetaType, [Type], Type) -- | Desugar a typechecked module. desugarModuleIO :: HscEnv -> ModSummary -> TypecheckedModuleLH -> IO ModGuts fsToUnitId :: FastString -> UnitId -- | Tells if a case alternative calls to patError isPatErrorAlt :: CoreAlt -> Bool lookupModSummary :: HscEnv -> ModuleName -> Maybe ModSummary modInfoLookupNameIO :: HscEnv -> ModuleInfoLH -> Name -> IO (Maybe TyThing) moduleInfoTc :: HscEnv -> TcGblEnv -> IO ModuleInfoLH parseModuleIO :: HscEnv -> ModSummary -> IO ParsedModule qualifiedNameFS :: Name -> FastString -- | The collection of dependencies and usages modules which are relevant -- for liquidHaskell relevantModules :: ModuleGraph -> ModGuts -> Set Module renderWithStyle :: DynFlags -> SDoc -> PprStyle -> String showPprQualified :: Outputable a => a -> String showSDocQualified :: SDoc -> String strictNothing :: Maybe a thisPackage :: DynFlags -> UnitId tyConRealArity :: TyCon -> Int typecheckModuleIO :: HscEnv -> ParsedModule -> IO TypecheckedModuleLH -- | Creates a new StableModule out of a ModuleName and a -- UnitId. mkStableModule :: UnitId -> ModuleName -> StableModule -- | Converts a Module into a StableModule. toStableModule :: Module -> StableModule renderModule :: Module -> String 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 -> ![TyCon] -> !HashSet StableName -> !Maybe [ClsInst] -> MGIModGuts [mgi_binds] :: MGIModGuts -> !CoreProgram [mgi_module] :: MGIModGuts -> !Module [mgi_tcs] :: MGIModGuts -> ![TyCon] [mgi_exports] :: MGIModGuts -> !HashSet StableName [mgi_cls_inst] :: MGIModGuts -> !Maybe [ClsInst] miModGuts :: Maybe [ClsInst] -> ModGuts -> MGIModGuts mgiNamestring :: 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 module Paths_liquidhaskell_boot 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 thd4 :: (t1, t2, t3, t4) -> t3 thrd3 :: (t1, t2, t3) -> t3 mapFifth5 :: (t -> t4) -> (t0, t1, t2, t3, t) -> (t0, t1, t2, t3, t4) 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] thd5 :: (t0, t1, t2, t3, t4) -> t2 snd5 :: (t0, t1, t2, t3, t4) -> t1 fst5 :: (t0, t1, t2, t3, t4) -> t0 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)] zip5 :: [t] -> [t1] -> [t2] -> [t3] -> [t4] -> [(t, t1, t2, t3, t4)] unzip4 :: [(t, t1, t2, t3)] -> ([t], [t1], [t2], [t3]) 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)] safeZip4WithError :: String -> [t1] -> [t2] -> [t3] -> [t4] -> [(t1, t2, t3, t4)] 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) 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] mapErr :: (a -> Either e b) -> [a] -> Either [e] [b] catEithers :: [Either a b] -> Either [a] [b] keyDiff :: (Eq k, Hashable k) => (a -> k) -> [a] -> [a] -> [a] concatUnzip :: [([a], [b])] -> ([a], [b]) sayReadFile :: FilePath -> IO String lastModified :: FilePath -> IO (Maybe UTCTime) data Validate e a Err :: e -> Validate e a Val :: a -> Validate e a instance GHC.Base.Functor (Language.Haskell.Liquid.Misc.Validate e) instance GHC.Base.Monoid e => GHC.Base.Applicative (Language.Haskell.Liquid.Misc.Validate e) -- | 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 -> Maybe SubcId -> !HashMap Symbol t -> !t -> !t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [cid] :: TError t -> Maybe SubcId [ctx] :: TError t -> !HashMap Symbol t [tact] :: TError t -> !t [texp] :: TError t -> !t -- | liquid type error with a counter-example ErrSubTypeModel :: !SrcSpan -> !Doc -> Maybe SubcId -> !HashMap Symbol (WithModel t) -> !WithModel t -> !t -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [msg] :: TError t -> !Doc [cid] :: TError t -> Maybe SubcId [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 -- | 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 -- | constructors in refinement do not match original datatype ErrDataConMismatch :: !SrcSpan -> !Doc -> [Doc] -> [Doc] -> TError t -- | haskell type location [pos] :: TError t -> !SrcSpan [var] :: TError t -> !Doc [dcs] :: TError t -> [Doc] [rdcs] :: 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 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 ErrPosTyCon :: SrcSpan -> !Doc -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> SrcSpan [tc] :: TError t -> !Doc [dc] :: TError t -> !Doc -- | Sigh. Other. ErrOther :: SrcSpan -> !Doc -> TError t -- | haskell type location [pos] :: TError t -> SrcSpan [msg] :: TError t -> !Doc type ParseError = ParseError String Void -- | 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 packRealSrcSpan :: 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 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 (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 Language.Haskell.Liquid.Types.Errors.ParseError instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Types.SrcLoc.SrcSpan instance Data.Aeson.Types.ToJSON.ToJSON GHC.Types.SrcLoc.RealSrcSpan instance Data.Aeson.Types.FromJSON.FromJSON GHC.Types.SrcLoc.RealSrcSpan instance Data.Aeson.Types.ToJSON.ToJSON GHC.Types.SrcLoc.SrcSpan instance Data.Aeson.Types.FromJSON.FromJSON GHC.Types.SrcLoc.SrcSpan instance Data.Aeson.Types.ToJSON.ToJSONKey GHC.Types.SrcLoc.SrcSpan instance Data.Aeson.Types.FromJSON.FromJSONKey GHC.Types.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 addTcRnUnknownMessage :: SrcSpan -> Doc -> TcRn () addTcRnUnknownMessages :: [(SrcSpan, Doc)] -> TcRn () fromPJDoc :: Doc -> SDoc putWarnMsg :: Logger -> SrcSpan -> Doc -> IO () -- | 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 -- -------------------------------------------- tickSrcSpan :: CoreTickish -> SrcSpan -- | Generic Helpers for Accessing GHC Innards -- --------------------------------- stringTyVar :: String -> TyVar stringVar :: String -> Type -> Var maybeAuxVar :: Symbol -> Maybe 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 isOrdClass :: 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 :: NamePprCtx 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 realSrcLocSourcePos :: RealSrcLoc -> 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 -- | Predicates on CoreExpr and DataCons -- --------------------------------------- isExternalId :: Id -> Bool 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 -- -------------------------------------------------------- symbolTyVar :: Symbol -> TyVar localVarSymbol :: Var -> Symbol exportedVarSymbol :: Var -> Symbol qualifiedNameSymbol :: Name -> Symbol fastStringText :: FastString -> Text tyConTyVarsDef :: TyCon -> [TyVar] noTyVars :: TyCon -> Bool -- | Manipulating Symbols -- ------------------------------------------------------ takeModuleUnique :: Symbol -> Symbol splitModuleUnique :: Symbol -> (Symbol, Int) base62ToI :: Symbol -> Int 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 isSCSel :: Symbolic a => a -> Bool stripParens :: Text -> Text stripParensSym :: Symbol -> Symbol desugarModule :: TypecheckedModule -> Ghc DesugaredModule -- | GHC Compatibility Layer -- --------------------------------------------------- gHC_VERSION :: String symbolFastString :: Symbol -> FastString synTyConRhs_maybe :: TyCon -> Maybe Type showCBs :: Bool -> [CoreBind] -> String ignoreCoreBinds :: HashSet Var -> [CoreBind] -> [CoreBind] findVarDef :: Symbol -> [CoreBind] -> Maybe (Var, CoreExpr) findVarDefMethod :: Symbol -> [CoreBind] -> Maybe (Var, CoreExpr) dictionarySymbols :: CoreBind -> [Symbol] methodSymbols :: CoreBind -> [Symbol] coreBindSymbols :: CoreBind -> [Symbol] simplesymbol :: NamedThing t => t -> Symbol binders :: Bind a -> [a] expandVarType :: Var -> Type -- | The following functions test if a CoreExpr or CoreVar -- can be embedded in logic. With type-class support, we can no longer -- erase such expressions arbitrarily. isEmbeddedDictExpr :: CoreExpr -> Bool isEmbeddedDictVar :: Var -> Bool isEmbeddedDictType :: Type -> Bool isPrelEqPred :: Type -> Bool isPrelEqTyCon :: TyCon -> Bool isOrdPred :: Type -> Bool isNumericPred :: Type -> Bool -- | 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 -- | Elaboration elabRnExpr :: LHsExpr GhcPs -> TcRn CoreExpr newtype HashableType HashableType :: Type -> HashableType [getHType] :: HashableType -> Type -- | Superclass coherence canonSelectorChains :: PredType -> Map HashableType [Id] buildCoherenceOblig :: Class -> [[([Id], [Id])]] coherenceObligToRef :: Symbolic s => s -> [Id] -> [Id] -> Reft coherenceObligToRefE :: Expr -> [Id] -> [Id] -> Reft data TcWiredIn TcWiredIn :: Name -> Maybe (Int, FixityDirection) -> LHsType GhcRn -> TcWiredIn [tcWiredInName] :: TcWiredIn -> Name [tcWiredInFixity] :: TcWiredIn -> Maybe (Int, FixityDirection) [tcWiredInType] :: TcWiredIn -> LHsType GhcRn -- | Run a computation in GHC's typechecking monad with wired in values -- locally bound in the typechecking environment. withWiredIn :: TcM a -> TcM a prependGHCRealQual :: FastString -> RdrName isFromGHCReal :: NamedThing a => a -> 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 GHC.Classes.Eq Language.Haskell.Liquid.GHC.Misc.HashableType instance GHC.Classes.Ord Language.Haskell.Liquid.GHC.Misc.HashableType instance GHC.Utils.Outputable.Outputable Language.Haskell.Liquid.GHC.Misc.HashableType instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.GHC.Misc.Loc instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (Data.HashSet.Internal.HashSet a) instance Data.Hashable.Class.Hashable GHC.Types.SrcLoc.SrcSpan instance Language.Fixpoint.Types.Spans.Loc GHC.Types.Var.Var instance Language.Fixpoint.Types.Names.Symbolic GHC.Data.FastString.FastString instance Language.Fixpoint.Types.Names.Symbolic GHC.Core.TyCon.TyCon instance Language.Fixpoint.Types.Names.Symbolic GHC.Core.Class.Class instance Language.Fixpoint.Types.Names.Symbolic GHC.Types.Name.Name instance Language.Fixpoint.Types.Names.Symbolic GHC.Types.Var.Var instance Data.Hashable.Class.Hashable GHC.Types.Var.Var instance Data.Hashable.Class.Hashable GHC.Core.TyCon.TyCon instance Data.Hashable.Class.Hashable GHC.Core.Class.Class instance Data.Hashable.Class.Hashable GHC.Core.DataCon.DataCon instance Language.Fixpoint.Types.PrettyPrint.Fixpoint GHC.Types.Var.Var instance Language.Fixpoint.Types.PrettyPrint.Fixpoint GHC.Types.Name.Name instance Language.Fixpoint.Types.PrettyPrint.Fixpoint GHC.Core.TyCo.Rep.Type instance GHC.Show.Show GHC.Types.Name.Name instance GHC.Show.Show GHC.Types.Var.Var instance GHC.Show.Show GHC.Core.Class.Class instance GHC.Show.Show GHC.Core.TyCon.TyCon instance Control.DeepSeq.NFData GHC.Core.Class.Class instance Control.DeepSeq.NFData GHC.Core.TyCon.TyCon instance Control.DeepSeq.NFData GHC.Core.TyCo.Rep.Type instance Control.DeepSeq.NFData GHC.Types.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 [GHC.Core.CoreBind] instance Language.Haskell.Liquid.Types.Visitors.CBVisitable GHC.Core.CoreBind instance Language.Haskell.Liquid.Types.Visitors.CBVisitable (GHC.Core.Expr GHC.Types.Var.Var) instance Language.Haskell.Liquid.Types.Visitors.CBVisitable (GHC.Core.Alt GHC.Types.Var.Var) instance Language.Haskell.Liquid.Types.Visitors.CBVisitable GHC.Core.AltCon module Language.Haskell.Liquid.Types.Variance data Variance Invariant :: Variance Bivariant :: Variance Contravariant :: Variance Covariant :: Variance type VarianceInfo = [Variance] makeTyConVariance :: TyCon -> VarianceInfo flipVariance :: Variance -> 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 GHC.Base.Semigroup Language.Haskell.Liquid.Types.Variance.Variance instance GHC.Base.Monoid 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 -- | 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 -- | Start Position [loc] :: Located a -> !SourcePos -- | End Position [locE] :: Located a -> !SourcePos [val] :: Located a -> !a dummyLoc :: a -> Located a -- | Located Symbols ----------------------------------------------------- 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 isEmbeddedClass :: TyConable c => RType c 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 -> !RFInfo -> !RType c tv r -> !RType c tv r -> !r -> RType c tv r [rt_bind] :: RType c tv r -> !Symbol [rt_rinfo] :: RType c tv r -> !RFInfo [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 -- | arguments. e.g. h in the above example [rf_args] :: Ref τ t -> [(Symbol, τ)] -- | Abstract refinement associated with RTyCon. e.g. v > -- h in the above example [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) 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 isEmbeddedDict :: TyConable c => c -> Bool isEqual :: TyConable c => c -> Bool isOrdCls :: TyConable c => c -> Bool isEqCls :: 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 data RelExpr ERBasic :: Expr -> RelExpr ERChecked :: Expr -> RelExpr -> RelExpr ERUnChecked :: Expr -> RelExpr -> RelExpr -- | 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] -> Maybe [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 (Nothing is reserved for non-GADT style empty data -- declarations) [tycDCons] :: DataDecl -> Maybe [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 [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 = -- | "Resolved" version RType RTyCon RTyVar type RRProp r = Ref RSort (RRType r) type BRType = -- | "Bare" parsed version RType BTyCon BTyVar 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] -> [RFInfo] -> [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_binds] :: RTypeRep c tv r -> [Symbol] [ty_info] :: RTypeRep c tv r -> [RFInfo] [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, RFInfo, RType c tv r, r)] -> RType c tv r -> RType c tv r bkArrowDeep :: RType t t1 a -> ([Symbol], [RFInfo], [RType t t1 a], [a], RType t t1 a) bkArrow :: RType t t1 a -> (([Symbol], [RFInfo], [RType t t1 a], [a]), RType t t1 a) safeBkArrow :: PPrint (RType t t1 a) => RType t t1 a -> (([Symbol], [RFInfo], [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) bkUnivClass' :: SpecType -> ([(SpecRTVar, RReft)], [PVar RSort], [(Symbol, SpecType, RReft)], SpecType) rFun :: Monoid r => Symbol -> RType c tv r -> RType c tv r -> RType c tv r rFun' :: Monoid r => RFInfo -> 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 rFunDebug :: Monoid r => Symbol -> RType c tv r -> 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 mapRFInfo :: (RFInfo -> RFInfo) -> 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 -- | Implement either pprintTidy or pprintPrec class () => PPrint a pprintTidy :: PPrint a => Tidy -> a -> Doc pprintPrec :: PPrint a => Int -> Tidy -> a -> Doc -- | Top-level pretty printer 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 :: Logger -> 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 -- | 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 newtype RFInfo RFInfo :: Maybe Bool -> RFInfo [permitTC] :: RFInfo -> Maybe Bool defRFInfo :: RFInfo mkRFInfo :: Config -> RFInfo classRFInfo :: Bool -> RFInfo classRFInfoType :: Bool -> RType c tv r -> RType c tv r ordSrcSpan :: SrcSpan -> SrcSpan -> Ordering instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.RFInfo instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.RFInfo instance Data.Data.Data Language.Haskell.Liquid.Types.Types.RFInfo instance GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.RFInfo 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 GHC.Generics.Generic Language.Haskell.Liquid.Types.Types.RelExpr instance Data.Data.Data Language.Haskell.Liquid.Types.Types.RelExpr instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.RelExpr instance GHC.Classes.Eq Language.Haskell.Liquid.Types.Types.RelExpr 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.Classes.Eq s => GHC.Classes.Eq (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 s, Data.Data.Data tv) => 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 tv, Data.Data.Data c, 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 c, GHC.Classes.Eq r) => 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 Data.Hashable.Class.Hashable x => GHC.Base.Monoid (Language.Haskell.Liquid.Types.Types.DEnv x ty) instance 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.Classes.Eq 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.Classes.Eq 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.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 ctor, Data.Data.Data ty) => 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 Language.Fixpoint.Types.PrettyPrint.PPrint a => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Types.Types.Output a) 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 Language.Fixpoint.Types.PrettyPrint.PPrint 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 GHC.Types.Var.Var GHC.Core.TyCo.Rep.Type GHC.Core.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 GHC.Core.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 Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.RelExpr instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.Types.Types.RelExpr 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 Data.Hashable.Class.Hashable Language.Haskell.Liquid.Types.Types.RFInfo instance Control.DeepSeq.NFData Language.Haskell.Liquid.Types.Types.RFInfo instance Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Types.RFInfo instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Haskell.Liquid.Types.Errors.TError a) instance Language.Fixpoint.Types.Names.Symbolic Language.Haskell.Syntax.Module.Name.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 GHC.Core.DataCon.DataCon instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Core.DataCon.DataCon instance GHC.Classes.Ord GHC.Core.TyCon.TyCon instance GHC.Classes.Ord GHC.Core.DataCon.DataCon instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Types.TyThing.TyThing instance GHC.Show.Show GHC.Core.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 :: Logger -> Warning -> IO () -- | Filters match errors. They are used to ignore classes of errors -- they match. AnyFilter matches all errors. StringFilter -- matches any error whose "representation" contains the given -- String. A "representation" is pretty-printed String of the -- error. data Filter StringFilter :: String -> Filter AnyFilter :: Filter -- | Retrieve the Filters from the Config. getFilters :: Config -> [Filter] -- | Return the list of filters that matched the err , -- given a renderer for the err and some -- filters reduceFilters :: (e -> String) -> [Filter] -> e -> [Filter] -- | Report errors via GHC's API stating the given Filters did not -- get matched. Does nothing if the list of filters is empty. defaultFilterReporter :: FilePath -> [Filter] -> TcRn () -- | Used in filterReportErrorsWith' data FilterReportErrorsArgs m filter msg e a FilterReportErrorsArgs :: ([e] -> m ()) -> ([filter] -> m ()) -> m a -> m a -> (e -> [filter]) -> [filter] -> FilterReportErrorsArgs m filter msg e a -- | Report the msgs to the monad (usually IO) [errorReporter] :: FilterReportErrorsArgs m filter msg e a -> [e] -> m () -- | Report unmatched filters to the monad [filterReporter] :: FilterReportErrorsArgs m filter msg e a -> [filter] -> m () -- | Continuation for when there are unmatched filters or unmatched errors [failure] :: FilterReportErrorsArgs m filter msg e a -> m a -- | Continuation for when there are no unmatched errors or filters [continue] :: FilterReportErrorsArgs m filter msg e a -> m a -- | Yields the filters that map a given error. Must only yield filters in -- the filters field. [matchingFilters] :: FilterReportErrorsArgs m filter msg e a -> e -> [filter] -- | List of filters which could have been matched [filters] :: FilterReportErrorsArgs m filter msg e a -> [filter] -- | Calls the continuations in FilterReportErrorsArgs depending on -- whethere there are unmatched errors, unmatched filters or none. filterReportErrorsWith :: (Monad m, Ord filter) => FilterReportErrorsArgs m filter msg e a -> [e] -> m a -- | Pretty-printing errors -- ---------------------------------------------------- -- -- Similar in spirit to reportErrors from the GHC API, but it -- uses our pretty-printer and shim functions under the hood. Also -- filters the errors according to the given Filter list. -- -- filterReportErrors failure continue filters k will call -- failure if there are unexpected errors, or will call -- continue otherwise. -- -- An error is expected if there is any filter that matches it. filterReportErrors :: forall e' a. (Show e', PPrint e') => FilePath -> TcRn a -> TcRn a -> [Filter] -> Tidy -> [TError e'] -> TcRn a instance GHC.Show.Show Language.Haskell.Liquid.Types.PrettyPrint.Filter instance GHC.Classes.Ord Language.Haskell.Liquid.Types.PrettyPrint.Filter instance GHC.Classes.Eq Language.Haskell.Liquid.Types.PrettyPrint.Filter instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Types.SourceError.SourceError instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Types.Var.Var instance Language.Fixpoint.Types.PrettyPrint.PPrint (GHC.Core.Expr GHC.Types.Var.Var) instance Language.Fixpoint.Types.PrettyPrint.PPrint (GHC.Core.Bind GHC.Types.Var.Var) instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Types.Name.Name instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Core.TyCon.TyCon instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Core.TyCo.Rep.Type instance Language.Fixpoint.Types.PrettyPrint.PPrint GHC.Core.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 module Language.Haskell.Liquid.Transforms.InlineAux inlineAux :: Config -> Module -> CoreProgram -> CoreProgram module Language.Haskell.Liquid.GHC.TypeRep mkTyArg :: TyVar -> TyVarBinder showTy :: Type -> String instance (GHC.Classes.Eq tyvar, GHC.Classes.Eq argf) => GHC.Classes.Eq (GHC.Types.Var.VarBndr tyvar argf) instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy GHC.Core.TyCo.Rep.Type instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy GHC.Core.TyCo.Rep.Coercion instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy Language.Haskell.Syntax.Basic.Role instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy (GHC.Core.Coercion.Axiom.CoAxiom GHC.Core.Coercion.Axiom.Branched) instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy GHC.Core.TyCo.Rep.UnivCoProvenance instance Language.Haskell.Liquid.GHC.TypeRep.SubstTy GHC.Core.Coercion.Axiom.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 GHC.Core.TyCo.Rep.Type instance GHC.Classes.Eq GHC.Core.TyCo.Rep.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 :: !CoreTickish -> 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 -- | Positivity Checker -- ------------------------------------------------------- getNonPositivesTyCon :: [TyCon] -> [(TyCon, [DataCon])] type OccurrenceMap = HashMap TyCon [(DataCon, TyConOccurrence)] data TyConOccurrence TyConOcc :: [TyCon] -> [TyCon] -> TyConOccurrence [posOcc] :: TyConOccurrence -> [TyCon] [negOcc] :: TyConOccurrence -> [TyCon] makeOccurrences :: [TyCon] -> OccurrenceMap makeOccurrence :: HashMap TyCon VarianceInfo -> [Type] -> TyConOccurrence findOccurrence :: OccurrenceMap -> TyCon -> TyConOccurrence isRecursivenewTyCon :: TyCon -> 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 GHC.Classes.Eq Language.Haskell.Liquid.GHC.Play.TyConOccurrence instance Language.Haskell.Liquid.GHC.Play.Subable GHC.Core.CoreExpr instance Language.Haskell.Liquid.GHC.Play.Subable GHC.Core.TyCo.Rep.Coercion instance Language.Haskell.Liquid.GHC.Play.Subable (GHC.Core.Alt GHC.Types.Var.Var) instance Language.Haskell.Liquid.GHC.Play.Subable GHC.Types.Var.Var instance Language.Haskell.Liquid.GHC.Play.Subable (GHC.Core.Bind GHC.Types.Var.Var) instance Language.Haskell.Liquid.GHC.Play.Subable GHC.Core.TyCo.Rep.Type instance GHC.Utils.Outputable.Outputable Language.Haskell.Liquid.GHC.Play.OccurrenceMap instance GHC.Base.Monoid Language.Haskell.Liquid.GHC.Play.TyConOccurrence instance GHC.Base.Semigroup Language.Haskell.Liquid.GHC.Play.TyConOccurrence instance GHC.Utils.Outputable.Outputable Language.Haskell.Liquid.GHC.Play.TyConOccurrence -- | 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 -> Maybe (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] allTyVars' :: Eq 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 => Bool -> 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 subsTyVarMeet :: (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 subsTyVarMeet' :: (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 subsTyVarNoMeet :: (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 subsTyVarsNoMeet :: (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 subsTyVarsMeet :: (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 -- #1476 and #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: -- -- {- foo :: ToNat {v:_ | 0 <= v} -} -- -- and we'd want to expand the above to -- -- {- foo :: {v:_ | 0 v} - Nat -} -- -- 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 GHC.Core.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 GHC.Types.Var.TyVar GHC.Core.TyCo.Rep.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 GHC.Types.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 is used to prettify the names of parameters of kvars -- appearing in solutions.(*) For example, if you have a kvar $k0 with -- two parameters, you may have a solution that looks like 0 < -- lq_karg$nnf_arg$##k0 where we know it is a kvar-arg because of the - -- kArgPrefix (lq_arg) - hvarArgPrefix -- (nnf_arg) - k0 the name of the kvar - `0` the -- parameter index - k0 again (IDK why?!) all of which are -- separated by ## So tidySymbol tests if indeed it is a -- kArgPrefix-ed symbol and if so converts `lq_karg$nnf_arg$##k0` -- ----> `$k0##0` 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 [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 :: Bool -> 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 substPVar :: PVar BSort -> PVar BSort -> BareType -> BareType 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)] charDataCon :: Located DataConP -- | 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 => Bool -> a -> m a refresh :: Freshable m a => Bool -> 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) => Bool -> [(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.Num.Integer.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.Num.Integer.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.Num.Integer.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.Num.Integer.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.Num.Integer.Integer => Language.Haskell.Liquid.Types.Fresh.Freshable m Language.Haskell.Liquid.Types.Types.RReft instance (Language.Haskell.Liquid.Types.Fresh.Freshable m GHC.Num.Integer.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 GHC.Base.Functor (Language.Haskell.Liquid.Types.Bounds.Bound a) 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 -> !ModName -> ![CoreBind] -> ![TyCon] -> !Maybe [ClsInst] -> !HashSet Var -> ![Var] -> ![Var] -> ![Var] -> !HashSet StableName -> ![TyCon] -> ![(Symbol, DataCon)] -> ![TyCon] -> !QImports -> !HashSet Symbol -> ![TyThing] -> TargetSrc -- | 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 -> 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) -> [([LocBareType], LocSymbol)] -> 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 -- | 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) [liftedDsize] :: LiftedSpec -> [([LocBareType], LocSymbol)] -- | ? 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 -- | 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 Expr is a PLE one. isPLEVar :: TargetSpec -> Var -> Bool -- | Returns True if the input Expr 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] -> !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, LocSymbol, ty, ty, RelExpr, RelExpr)] -> ![(LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr)] -> ![(LocSymbol, [Located Expr])] -> ![RInstance ty] -> ![RILaws ty] -> ![(LocSymbol, [Variance])] -> ![([ty], LocSymbol)] -> !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] -- | 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] -- | Relational types [relational] :: Spec ty bndr -> ![(LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr)] -- | Assumed relational types [asmRel] :: Spec ty bndr -> ![(LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr)] -- | Terminating Conditions for functions [termexprs] :: Spec ty bndr -> ![(LocSymbol, [Located Expr])] [rinstance] :: Spec ty bndr -> ![RInstance ty] [ilaws] :: Spec ty bndr -> ![RILaws ty] -- | TODO ? Where do these come from ?! [dvariance] :: Spec ty bndr -> ![(LocSymbol, [Variance])] -- | Size measure to enforce fancy termination [dsize] :: Spec ty bndr -> ![([ty], LocSymbol)] [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 Exprs 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])] -> ![(Var, Var, LocSpecType, LocSpecType, RelExpr, RelExpr)] -> ![(Var, Var, LocSpecType, LocSpecType, RelExpr, RelExpr)] -> 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])] [gsRelation] :: GhcSpecSig -> ![(Var, Var, LocSpecType, LocSpecType, RelExpr, RelExpr)] [gsAsmRel] :: GhcSpecSig -> ![(Var, Var, LocSpecType, LocSpecType, RelExpr, RelExpr)] 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) -> !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) -- | 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 -> !ModName -> ![CoreBind] -> ![TyCon] -> !Maybe [ClsInst] -> !HashSet Var -> ![Var] -> ![Var] -> ![Var] -> !HashSet StableName -> ![TyCon] -> ![(Symbol, DataCon)] -> ![TyCon] -> !QImports -> !HashSet Symbol -> ![TyThing] -> GhcSrc -- | 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 toTargetSrc :: GhcSrc -> TargetSrc fromTargetSrc :: TargetSrc -> GhcSrc toTargetSpec :: GhcSpec -> (TargetSpec, LiftedSpec) toBareSpec :: Spec LocBareType LocSymbol -> BareSpec fromBareSpec :: BareSpec -> Spec LocBareType LocSymbol toLiftedSpec :: Spec LocBareType LocSymbol -> LiftedSpec unsafeFromLiftedSpec :: LiftedSpec -> Spec LocBareType LocSymbol emptyLiftedSpec :: LiftedSpec instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.QImports instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecVars instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecQual instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecSig instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecData instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecNames instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecTerm instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecRefl instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.LawInstance instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.GhcSpecLaws instance GHC.Show.Show Language.Haskell.Liquid.Types.Specs.TargetSpec 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.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 Data.Binary.Class.Binary Language.Haskell.Liquid.Types.Specs.TargetDependencies instance GHC.Generics.Generic 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 GHC.Show.Show Language.Haskell.Liquid.Types.Types.TyConP instance GHC.Show.Show Language.Haskell.Liquid.Types.Types.TyConMap instance Language.Haskell.Liquid.UX.Config.HasConfig Language.Haskell.Liquid.Types.Specs.GhcSpec instance GHC.Base.Semigroup 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.BareSpec instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.BareSpec 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 instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Specs.GhcSpecRefl instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.GhcSpecRefl instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Specs.GhcSpecTerm instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.GhcSpecTerm instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Specs.GhcSpecSig instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.GhcSpecSig instance GHC.Base.Semigroup Language.Haskell.Liquid.Types.Specs.GhcSpecVars instance GHC.Base.Monoid Language.Haskell.Liquid.Types.Specs.GhcSpecVars instance Data.Binary.Class.Binary Language.Fixpoint.Types.Constraints.Equation 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] -> !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, LocSymbol, ty, ty, RelExpr, RelExpr)] -> ![(LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr)] -> ![(LocSymbol, [Located Expr])] -> ![RInstance ty] -> ![RILaws ty] -> ![(LocSymbol, [Variance])] -> ![([ty], LocSymbol)] -> !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] -- | 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] -- | Relational types [relational] :: Spec ty bndr -> ![(LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr)] -- | Assumed relational types [asmRel] :: Spec ty bndr -> ![(LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr)] -- | Terminating Conditions for functions [termexprs] :: Spec ty bndr -> ![(LocSymbol, [Located Expr])] [rinstance] :: Spec ty bndr -> ![RInstance ty] [ilaws] :: Spec ty bndr -> ![RILaws ty] -- | TODO ? Where do these come from ?! [dvariance] :: Spec ty bndr -> ![(LocSymbol, [Variance])] -- | Size measure to enforce fancy termination [dsize] :: Spec ty bndr -> ![([ty], LocSymbol)] [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 :: Bool -> MSpec (RRType Reft) DataCon -> ([(Var, RRType Reft)], [(LocSymbol, RRType Reft)]) defRefType :: Bool -> 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 e r -> Either e (Maybe r) instance GHC.Show.Show v => GHC.Show.Show (Language.Haskell.Liquid.Bare.Types.PlugTV v) instance GHC.Base.Semigroup Language.Haskell.Liquid.Bare.Types.MeasEnv instance GHC.Base.Monoid Language.Haskell.Liquid.Bare.Types.MeasEnv 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 GHC.Types.Unique.Unique instance Language.Haskell.Liquid.Transforms.Rec.Freshable GHC.Types.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 GHC.Types.Unique.Supply.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 instance GHC.Classes.Eq Language.Haskell.Liquid.Transforms.ANF.StableId instance Data.Hashable.Class.Hashable Language.Haskell.Liquid.Transforms.ANF.StableId instance GHC.Show.Show Language.Haskell.Liquid.Transforms.ANF.StableId module Language.Haskell.Liquid.Bare.Misc joinVar :: [Var] -> (Var, s, t) -> (Var, s, t) mkVarExpr :: Id -> Expr vmap :: MapTyVarST -> [(Var, RTyVar)] runMapTyVars :: Bool -> Type -> SpecType -> (Doc -> Doc -> Error) -> Either Error MapTyVarST matchKindArgs :: [SpecType] -> [SpecType] -> [SpecType] symbolRTyVar :: Symbol -> RTyVar simpleSymbolVar :: Var -> Symbol hasBoolResult :: Type -> Bool isKind :: Kind -> Bool -- | This module uses GHC API to elaborate the resolves expressions module Language.Haskell.Liquid.Bare.Elaborate -- | Embed fixpoint expressions into parsed haskell expressions. It allows -- us to bypass the GHC parser and use arbitrary symbols for identifiers -- (compared to using the string API) fixExprToHsExpr :: HashSet Symbol -> Expr -> LHsExpr GhcPs elaborateSpecType :: (CoreExpr -> Expr) -> (CoreExpr -> TcRn CoreExpr) -> SpecType -> TcRn SpecType instance GHC.Base.Functor (Language.Haskell.Liquid.Bare.Elaborate.RTypeF c tv r) instance Data.Functor.Foldable.Recursive (Language.Haskell.Liquid.Types.Types.RType c tv r) instance Data.Functor.Foldable.Corecursive (Language.Haskell.Liquid.Types.Types.RType c tv r) -- | 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 -> Lookup a class Qualify a qualify :: Qualify a => Env -> ModName -> SourcePos -> [Symbol] -> a -> a type Lookup a = Either [Error] 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 -> Lookup DataCon lookupGhcDnTyCon :: Env -> ModName -> String -> DataName -> Lookup (Maybe TyCon) lookupGhcTyCon :: Env -> ModName -> String -> LocSymbol -> Lookup TyCon lookupGhcVar :: Env -> ModName -> String -> LocSymbol -> Lookup 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] coSubRReft :: CoSub -> RReft -> RReft -- | `unQualifySymbol name sym` splits sym into a pair `(mod, -- rest)` where mod is the name of the module, derived from -- sym if qualified. unQualifySymbol :: Symbol -> (Maybe Symbol, Symbol) ofBareTypeE :: Env -> ModName -> SourcePos -> Maybe [PVar BSort] -> BareType -> Lookup 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 -> Error -- | 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 GHC.Types.Var.Var instance Language.Haskell.Liquid.Bare.Resolve.ResolveSym GHC.Core.TyCon.TyCon instance Language.Haskell.Liquid.Bare.Resolve.ResolveSym GHC.Core.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 GHC.Core.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 a => Language.Haskell.Liquid.Bare.Resolve.Qualify (Language.Haskell.Liquid.Types.Types.RTAlias Language.Fixpoint.Types.Names.Symbol a) 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] -> (Diagnostics, [DataDecl]) -- | Bare Predicate: DataCon Definitions -- --------------------------------------- makeConTypes :: ModName -> Env -> [(ModName, BareSpec)] -> Lookup ([(ModName, TyConP, Maybe DataPropDecl)], [[Located DataConP]]) makeRecordSelectorSigs :: Env -> ModName -> [Located DataConP] -> [(Var, LocSpecType)] meetDataConSpec :: Bool -> TCEmb TyCon -> [(Var, SpecType)] -> [DataConP] -> [(Var, SpecType)] dataDeclSize :: BareSpec -> [DataDecl] -> [DataDecl] module Language.Haskell.Liquid.Transforms.CoreToLogic coreToDef :: Reftable r => Bool -> LocSymbol -> Var -> CoreExpr -> LogicM [Def (Located (RRType r)) DataCon] coreToFun :: Bool -> LocSymbol -> Var -> CoreExpr -> LogicM ([Var], Either Expr Expr) coreToLogic :: Bool -> 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 => Bool -> Type -> RRType r -- | inlineSpecType :: Bool -> 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 :: Bool -> 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 :: Bool -> Var -> SpecType -> SpecType normalize :: Simplify a => Bool -> a -> a instance Language.Haskell.Liquid.Transforms.CoreToLogic.Simplify GHC.Core.CoreExpr instance Language.Haskell.Liquid.Transforms.CoreToLogic.Simplify GHC.Core.CoreBind instance Language.Haskell.Liquid.Transforms.CoreToLogic.Simplify GHC.Core.CoreAlt instance GHC.Show.Show GHC.Core.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 -- | Variable definitions data Def D :: Int -> Int -> Var -> Def -- | line at which binder definition starts [start] :: Def -> Int -- | line at which binder definition ends [end] :: Def -> Int -- | name of binder [binder] :: Def -> Var coreDefs :: [CoreBind] -> [Def] 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.Def instance Language.Fixpoint.Types.PrettyPrint.PPrint Language.Haskell.Liquid.UX.DiffCheck.DiffCheck instance Data.Aeson.Types.ToJSON.ToJSON Text.Megaparsec.Pos.SourcePos instance Data.Aeson.Types.FromJSON.FromJSON Text.Megaparsec.Pos.SourcePos 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 :: MonadIO m => Config -> FilePath -> [Located String] -> (Config -> m a) -> m a -- | Attempt to canonicalize all FilePaths in the Config so -- we don't have to worry about relative paths. canonicalizePaths :: FilePath -> Config -> IO Config 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)] -- | Write the annotations (i.e. the files in the ".liquid" hidden folder) -- and report the result of the checking using a supplied function, or -- using an implicit JSON function, if json flag is set. 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 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.Parse -- | Used to parse .hs and .lhs files (via ApiAnnotations). hsSpecificationP :: ModuleName -> [(SourcePos, String)] -> [BPspec] -> Either [Error] (ModName, BareSpec) -- | Used to parse .spec files. specSpecificationP :: SourceName -> String -> Either (ParseErrorBundle String Void) (ModName, BareSpec) singleSpecP :: SourcePos -> String -> Either (ParseErrorBundle String Void) 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 -- TODO RJ: what is this LAsrt :: (LocSymbol, ty) -> Pspec ty ctor -- | TODO 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 -- | relational signature Relational :: (LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr) -> Pspec ty ctor -- | assume relational signature AssmRel :: (LocSymbol, LocSymbol, ty, ty, RelExpr, RelExpr) -> 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 -- | 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 -- | 'data size' annotations, generating fancy termination metric DSize :: ([ty], LocSymbol) -> 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 (ParseErrorBundle String Void) LogicMap -- | Function to test parsers interactively. parseTest' :: Show a => Parser a -> String -> IO () 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 (Language.Fixpoint.Types.PrettyPrint.PPrint ty, Language.Fixpoint.Types.PrettyPrint.PPrint ctor, GHC.Show.Show ty) => GHC.Show.Show (Language.Haskell.Liquid.Parse.Pspec ty ctor) instance (Data.Data.Data ctor, Data.Data.Data ty) => 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.GHC.Interface pprintCBs :: [CoreBind] -> Doc -- | Extract Specifications from GHC -- ------------------------------------------- extractSpecComments :: ParsedModule -> [(Maybe RealSrcLoc, String)] extractSpecQuotes' :: (a -> Module) -> (a -> [Annotation]) -> a -> [BPspec] makeLogicMap :: IO LogicMap -- | Extract Ids -- --------------------------------------------------------------- classCons :: Maybe [ClsInst] -> [Id] derivedVars :: Config -> MGIModGuts -> [Var] importVars :: CoreProgram -> [Id] allImports :: [LImportDecl GhcRn] -> HashSet Symbol qualifiedImports :: [LImportDecl GhcRn] -> QImports modSummaryHsFile :: ModSummary -> FilePath -- | Family instance information makeFamInstEnv :: [FamInst] -> ([TyCon], [(Symbol, DataCon)]) -- | Finding & Parsing Files -- --------------------------------------------------- -- -- Parse a spec file by path. -- -- On a parse error, we fail. -- -- TODO, Andres: It would be better to fail more systematically, but -- currently we seem to have an option between throwing an error which -- will be reported badly, or printing the error ourselves. parseSpecFile :: FilePath -> IO (ModName, BareSpec) clearSpec :: BareSpec -> BareSpec checkFilePragmas :: [Located String] -> IO () 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 :: HscEnv -> TcGblEnv -> IO [(Name, Maybe TyThing)] -- | Returns all the available (i.e. exported) TyCons (type -- constructors) for the input Module. availableTyCons :: HscEnv -> TcGblEnv -> [AvailInfo] -> IO [TyCon] -- | Returns all the available (i.e. exported) Exprs for the input -- Module. availableVars :: HscEnv -> TcGblEnv -> [AvailInfo] -> IO [Var] -- | Per-Module Pipeline -- ------------------------------------------------------- updLiftedSpec :: BareSpec -> Maybe BareSpec -> BareSpec 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 GHC.Types.SourceError.SourceError module Language.Haskell.Liquid.Constraint.Types type CG = State CGInfo -- | Generation: Types -- --------------------------------------------------------- data CGInfo CGInfo :: !SEnv Sort -> ![SubC] -> ![WfC] -> ![FixSubC] -> ![FixWfC] -> !Integer -> !FixBindEnv -> ![BindId] -> !AnnInfo (Annot SpecType) -> !TyConMap -> !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 -> !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 -> !FixBindEnv -- | existentials [ebinds] :: CGInfo -> ![BindId] -- | source-position annotation map [annotMap] :: CGInfo -> !AnnInfo (Annot SpecType) -- | information about type-constructors [tyConInfo] :: CGInfo -> !TyConMap -- | 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 -- | Enable typeclass support [cgiTypeclass] :: 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 newtype 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 getLocation :: CGEnv -> SrcSpan 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 -- freshTyType and freshTyExpr freshTyType :: Bool -> KVKind -> CoreExpr -> Type -> CG SpecType freshTyExpr :: Bool -> KVKind -> CoreExpr -> Type -> CG SpecType trueTy :: Bool -> Type -> CG SpecType addKuts :: PPrint a => a -> SpecType -> CG () instance Language.Haskell.Liquid.Types.Fresh.Freshable Language.Haskell.Liquid.Constraint.Types.CG GHC.Num.Integer.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 -- | 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 () -- | 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) module Language.Haskell.Liquid.Constraint.Template data Template a Asserted :: a -> Template a Assumed :: a -> Template a Internal :: a -> Template a Unknown :: Template a unTemplate :: Template t -> t -- | varTemplate is only called with a `Just e` argument when the -- e corresponds to the body of a Rec binder. varTemplate :: CGEnv -> (Var, Maybe CoreExpr) -> CG (Template SpecType) addPostTemplate :: CGEnv -> Template SpecType -> CG (Template SpecType) safeFromAsserted :: [Char] -> Template t -> t -- | topSpecType strips out the top-level refinement of "derived -- var" topSpecType :: Var -> SpecType -> CG SpecType derivedVar :: TargetSrc -> Var -> Bool extender :: Symbolic a => CGEnv -> (a, Template SpecType) -> CG CGEnv instance Data.Traversable.Traversable Language.Haskell.Liquid.Constraint.Template.Template instance Data.Foldable.Foldable Language.Haskell.Liquid.Constraint.Template.Template instance GHC.Base.Functor Language.Haskell.Liquid.Constraint.Template.Template instance GHC.Show.Show a => GHC.Show.Show (Language.Haskell.Liquid.Constraint.Template.Template a) instance Language.Fixpoint.Types.PrettyPrint.PPrint a => Language.Fixpoint.Types.PrettyPrint.PPrint (Language.Haskell.Liquid.Constraint.Template.Template a) -- | This module defines code for generating termination constraints. module Language.Haskell.Liquid.Constraint.Termination data TCheck TerminationCheck :: TCheck StrataCheck :: TCheck NoCheck :: TCheck mkTCheck :: Bool -> Bool -> TCheck doTermCheck :: Config -> Bind Var -> CG Bool makeTermEnvs :: CGEnv -> [(Var, [Located Expr])] -> [(Var, CoreExpr)] -> [SpecType] -> [SpecType] -> [CGEnv] -- | TERMINATION TYPE -- ---------------------------------------------------------- makeDecrIndex :: (Var, Template SpecType, [Var]) -> CG (Maybe Int) checkIndex :: (NamedThing t, PPrint t, PPrint a) => (t, [a], Template (RType c tv r), Maybe Int) -> CG (Maybe (RType c tv r)) recType :: Symbolic a => HashSet TyCon -> (([a], Maybe Int), (t, Maybe Int, SpecType)) -> SpecType unOCons :: RType c tv r -> RType c tv r consCBSizedTys :: (Bool -> CGEnv -> (Var, CoreExpr, Template SpecType) -> CG (Template SpecType)) -> CGEnv -> [(Var, CoreExpr)] -> CG CGEnv consCBWithExprs :: (Bool -> CGEnv -> (Var, CoreExpr, Template SpecType) -> CG (Template SpecType)) -> CGEnv -> [(Var, CoreExpr)] -> CG CGEnv instance GHC.Show.Show Language.Haskell.Liquid.Constraint.Termination.TCheck -- | This module defines the representation of Subtyping and WF -- Constraints, and the code for syntax-directed constraint generation. module Language.Haskell.Liquid.Constraint.Relational consAssmRel :: Config -> TargetInfo -> (PrEnv, CGEnv) -> (Var, Var, LocSpecType, LocSpecType, RelExpr, RelExpr) -> CG (PrEnv, CGEnv) consRelTop :: Config -> TargetInfo -> CGEnv -> PrEnv -> (Var, Var, LocSpecType, LocSpecType, RelExpr, RelExpr) -> CG () instance GHC.Show.Show Language.Haskell.Liquid.Constraint.Relational.RelPred -- | 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 :: Bool -> SubC -> CG [FixSubC] splitW :: WfC -> CG [FixWfC] envToSub :: [(a, b)] -> ([(a, b)], b, b) -- | Constraint Generation Panic -- ----------------------------------------------- panicUnbound :: PPrint x => CGEnv -> x -> a module Language.Haskell.Liquid.Bare.Typeclass compileClasses :: GhcSrc -> Env -> (ModName, BareSpec) -> [(ModName, BareSpec)] -> (BareSpec, [(ClsInst, [Var])]) -- | elaborateClassDcp behaves differently from other datacon -- functions. Each method type contains the full forall quantifiers -- instead of having them chopped off elaborateClassDcp :: (CoreExpr -> Expr) -> (CoreExpr -> TcRn CoreExpr) -> DataConP -> TcRn (DataConP, DataConP) makeClassAuxTypes :: (SpecType -> TcRn SpecType) -> [Located DataConP] -> [(ClsInst, [Var])] -> TcRn [(Var, LocSpecType)] -- | 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 -- | This module has a function that computes the "slice" i.e. subset of -- the BareSpec that we actually need to verify a given target -- module, so that LH doesn't choke trying to resolve names that are not -- actually relevant and hence, not in the GHC Environment. See LH issue -- 1773 for more details. -- -- Specifically, this module has datatypes and code for building a -- Specification Dependency Graph whose vertices are names that -- need to be resolve, and edges are dependencies. module Language.Haskell.Liquid.Bare.Slice -- | Top-level "slicing" function sliceSpecs :: GhcSrc -> BareSpec -> [(ModName, BareSpec)] -> [(ModName, BareSpec)] 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 :: Bool -> ModName -> TCEmb TyCon -> TyConMap -> HashSet StableName -> PlugTV Var -> LocSpecType -> LocSpecType makePluggedDataCon :: Bool -> 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. -- -- When expanding, it's important we pass around a BareRTEnv where -- the type aliases have been qualified as well. This is subtle, see for -- example T1761. In that test, we had a type alias "OneTyAlias a = {v:a -- | oneFunPred v}" where "oneFunPred" was marked inline. However, -- inlining couldn't happen because the BareRTEnv had an entry for -- "T1761.oneFunPred", so the relevant expansion of "oneFunPred" couldn't -- happen. This was because the type alias entry inside BareRTEnv -- mentioned the tuple ("OneTyAlias", "{v:a | oneFunPred v}") but the -- snd element needed to be qualified as well, before trying to -- expand anything. qualifyExpand :: (PPrint a, 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 -> Lookup LocSpecType specExpandType :: BareRTEnv -> LocSpecType -> LocSpecType plugHoles :: Bool -> 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 -> Lookup [(Var, LocSpecType, Equation)] -- | Hardcode imported reflected functions -- ------------------------------------ wiredReflects :: Config -> Env -> ModName -> GhcSpecSig -> Lookup [Var] instance Language.Haskell.Liquid.Bare.Axiom.Subable GHC.Types.Var.Var instance Language.Haskell.Liquid.Bare.Axiom.Subable GHC.Core.CoreExpr instance Language.Haskell.Liquid.Bare.Axiom.Subable GHC.Core.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 caseEnv :: CGEnv -> Var -> [AltCon] -> AltCon -> [Var] -> Maybe [Int] -> CG CGEnv -- | Bidirectional Constraint Generation: SYNTHESIS -- ---------------------------- consE :: CGEnv -> CoreExpr -> CG SpecType instance Control.Monad.Fail.MonadFail Data.Functor.Identity.Identity module Language.Haskell.Liquid.Liquid checkTargetInfo :: TargetInfo -> IO (Output Doc) -- | 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 :: Bool -> GhcSrc -> TycEnv -> LogicMap -> BareSpec -> [Measure (Located BareType) LocSymbol] makeHaskellInlines :: Bool -> 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) -> Lookup (MSpec SpecType DataCon) makeMeasureSpec' :: Bool -> 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 -> Lookup ([DataConP], [(ModName, Var, LocSpecType)]) makeCLaws :: Env -> SigEnv -> ModName -> ModSpecs -> Lookup [(Class, [(ModName, Var, LocSpecType)])] makeSpecDictionaries :: Env -> SigEnv -> ModSpecs -> DEnv Var LocSpecType makeDefaultMethods :: Env -> [(ModName, Var, LocSpecType)] -> [(ModName, Var, LocSpecType)] makeMethodTypes :: Bool -> 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 () -- | Checking TargetSrc -- ------------------------------------------------------------------------ checkTargetSrc :: Config -> TargetSrc -> 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 -> TcRn (Either Diagnostics ([Warning], TargetSpec, LiftedSpec)) -- | De/Serializing Spec files loadLiftedSpec :: Config -> FilePath -> IO (Maybe BareSpec) saveLiftedSpec :: FilePath -> BareSpec -> IO () -- | 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 GHC.Show.Show Language.Haskell.Liquid.GHC.Plugin.LiquidCheckException instance GHC.Classes.Ord Language.Haskell.Liquid.GHC.Plugin.LiquidCheckException instance GHC.Classes.Eq Language.Haskell.Liquid.GHC.Plugin.LiquidCheckException instance Language.Haskell.Liquid.GHC.Plugin.Unoptimise GHC.Driver.Session.DynFlags instance Language.Haskell.Liquid.GHC.Plugin.Unoptimise GHC.Unit.Module.ModSummary.ModSummary instance Language.Haskell.Liquid.GHC.Plugin.Unoptimise (GHC.Driver.Session.DynFlags, GHC.Driver.Env.Types.HscEnv) module LiquidHaskellBoot lq :: QuasiQuoter -- | The Plugin entrypoint -- ------------------------------------------------------ plugin :: Plugin