hiedb-0.6.0.1: Generates a references DB from .hie files
Safe HaskellSafe-Inferred
LanguageHaskell2010

HieDb.Create

Synopsis

Documentation

checkVersion :: (HieDb -> IO a) -> HieDb -> IO a Source #

checkVersion f db checks the schema version associated with given db. If that version is supported by hiedb, it runs the function f with the db. Otherwise it throws IncompatibleSchemaVersion exception.

withHieDb :: FilePath -> (HieDb -> IO a) -> IO a Source #

Given path to .hiedb file, constructs HieDb and passes it to given function.

withHieDbAndFlags :: LibDir -> FilePath -> (DynFlags -> HieDb -> IO a) -> IO a Source #

Given GHC LibDir and path to .hiedb file, constructs DynFlags (required for printing info from .hie files) and HieDb and passes them to given function.

initConn :: HieDb -> IO () Source #

Initialize database schema for given HieDb.

addArr :: HieDb -> Array TypeIndex HieTypeFlat -> IO (Array TypeIndex (Maybe Int64)) Source #

Add names of types from .hie file to HieDb. Returns an Array mapping TypeIndex to database ID assigned to the corresponding record in DB.

addTypeRefs Source #

Arguments

:: HieDb 
-> FilePath

Path to .hie file

-> HieFile

Data loaded from the .hie file

-> Array TypeIndex (Maybe Int64)

Maps TypeIndex to database ID assigned to record in typenames table

-> IO () 

Add references to types from given .hie file to DB.

data SkipOptions Source #

Options to skip indexing phases

Constructors

SkipOptions 

Fields

Instances

Instances details
Show SkipOptions Source # 
Instance details

Defined in HieDb.Create

addRefsFrom :: (MonadIO m, NameCacheMonad m) => HieDb -> Maybe FilePath -> SkipOptions -> FilePath -> m Bool Source #

Adds all references from given .hie file to HieDb. The indexing is skipped if the file was not modified since the last time it was indexed. The boolean returned is true if the file was actually indexed

addRefsFromLoaded Source #

Arguments

:: MonadIO m 
=> HieDb

HieDb into which we're adding the file

-> FilePath

Path to .hie file

-> SourceFile

Path to .hs file from which .hie file was created Also tells us if this is a real source file? i.e. does it come from user's project (as opposed to from project's dependency)?

-> Fingerprint

The hash of the .hie file

-> HieFile

Data loaded from the .hie file

-> m () 

addRefsFromLoadedInternal Source #

Arguments

:: MonadIO m 
=> HieDb

HieDb into which we're adding the file

-> FilePath

Path to .hie file

-> SourceFile

Path to .hs file from which .hie file was created Also tells us if this is a real source file? i.e. does it come from user's project (as opposed to from project's dependency)?

-> Fingerprint

The hash of the .hie file

-> SkipOptions

Skip indexing certain tables

-> HieFile

Data loaded from the .hie file

-> m () 

addRefsFromLoaded_unsafe Source #

Arguments

:: MonadIO m 
=> HieDb

HieDb into which we're adding the file

-> FilePath

Path to .hie file

-> SourceFile

Path to .hs file from which .hie file was created Also tells us if this is a real source file? i.e. does it come from user's project (as opposed to from project's dependency)?

-> Fingerprint

The hash of the .hie file

-> SkipOptions

Skip indexing certain tables

-> HieFile

Data loaded from the .hie file

-> m () 

Like addRefsFromLoaded but without: 1) using a transaction 2) cleaning up previous versions of the file

Mostly useful to index a new database from scratch as fast as possible

addSrcFile Source #

Arguments

:: HieDb 
-> FilePath

Path to .hie file

-> FilePath

Path to .hs file to be added to DB

-> Bool

Is this a real source file? I.e. does it come from user's project (as opposed to from project's dependency)?

-> IO () 

Add path to .hs source given path to .hie file which has already been indexed. No action is taken if the corresponding .hie file has not been indexed yet.

removeDependencySrcFiles :: HieDb -> IO () Source #

Remove the path to .hs source for all dependency .hie files. Useful for resetting the indexed dependencies if the sources have been deleted for some reason.

deleteFileFromIndex :: HieDb -> FilePath -> IO () Source #

Delete all occurrences of given .hie file from the database

deleteMissingRealFiles :: HieDb -> IO () Source #

Delete all entries associated with modules for which the modInfoSrcFile doesn't exist on the disk. Doesn't delete it if there is no associated modInfoSrcFile

garbageCollectTypeNames :: HieDb -> IO Int Source #

Garbage collect typenames with no references - it is a good idea to call this function after a sequence of database updates (inserts or deletes)