HieDb.Types

hiedb-0.6.0.1: Generates a references DB from .hie files

Safe Haskell | None
Language | Haskell2010

HieDb.Types

Contents

- Orphan instances

Synopsis

- newtype HieDb = HieDb {
  - getConn :: Connection
  }
- data HieDbException = IncompatibleSchemaVersion {
  - expectedVersion :: Integer
  - gotVersion :: Integer
  }
- setHieTrace :: HieDb -> Maybe (Text -> IO ()) -> IO ()
- data SourceFile
  - = RealFile FilePath
  - | FakeFile (Maybe FilePath)
- data ModuleInfo = ModuleInfo {
  - modInfoName :: ModuleName
  - modInfoUnit :: Unit
  - modInfoIsBoot :: Bool
  - modInfoSrcFile :: Maybe FilePath
  - modInfoIsReal :: Bool
  - modInfoHash :: Fingerprint
  }
- type Res a = a :. ModuleInfo
- toNsChar :: NameSpace -> String
- fromNsChar :: Text -> Maybe NameSpace
- data HieModuleRow = HieModuleRow {
  - hieModuleHieFile :: FilePath
  - hieModInfo :: ModuleInfo
  }
- data RefRow = RefRow {
  - refSrc :: FilePath
  - refNameOcc :: OccName
  - refNameMod :: ModuleName
  - refNameUnit :: Unit
  - refSLine :: Int
  - refSCol :: Int
  - refELine :: Int
  - refECol :: Int
  }
- data DeclRow = DeclRow {
  - declSrc :: FilePath
  - declNameOcc :: OccName
  - declSLine :: Int
  - declSCol :: Int
  - declELine :: Int
  - declECol :: Int
  - declRoot :: Bool
  }
- data ImportRow = ImportRow {
  - importSrc :: FilePath
  - importModuleName :: ModuleName
  - importSLine :: Int
  - importSCol :: Int
  - importELine :: Int
  - importECol :: Int
  }
- data TypeName = TypeName {
  - typeName :: OccName
  - typeMod :: ModuleName
  - typeUnit :: Unit
  }
- data TypeRef = TypeRef {
  - typeRefOccId :: Int64
  - typeRefHieFile :: FilePath
  - typeRefDepth :: Int
  - typeRefSLine :: Int
  - typeRefSCol :: Int
  - typeRefELine :: Int
  - typeRefECol :: Int
  }
- data DefRow = DefRow {
  - defSrc :: FilePath
  - defNameOcc :: OccName
  - defSLine :: Int
  - defSCol :: Int
  - defELine :: Int
  - defECol :: Int
  }
- data ExportRow = ExportRow {
  - exportHieFile :: FilePath
  - exportName :: OccName
  - exportMod :: ModuleName
  - exportUnit :: Unit
  - exportParent :: Maybe OccName
  - exportParentMod :: Maybe ModuleName
  - exportParentUnit :: Maybe Unit
  - exportIsDatacon :: Bool
  }
- class Monad m => NameCacheMonad (m :: Type -> Type) where
  - getNcUpdater :: m NameCacheUpdater
- newtype DbMonadT (m :: Type -> Type) a = DbMonadT {
  - runDbMonad :: ReaderT (IORef NameCache) m a
  }
- type DbMonad = DbMonadT IO
- runDbM :: IORef NameCache -> DbMonad a -> IO a
- data HieDbErr
  - = NotIndexed ModuleName (Maybe Unit)
  - | AmbiguousUnitId (NonEmpty ModuleInfo)
  - | NameNotFound OccName (Maybe ModuleName) (Maybe Unit)
  - | NoNameAtPoint HieTarget (Int, Int)
  - | NameUnhelpfulSpan Name String
- data Symbol = Symbol {
  - symName :: !OccName
  - symModule :: !Module
  }
- readNameSpace :: ReadP NameSpace
- readColon :: ReadP ()
- readSymbol :: ReadP Symbol
- newtype LibDir = LibDir FilePath
- type HieTarget = Either FilePath (ModuleName, Maybe Unit)

# Documentation

newtype HieDb #

Constructors

HieDb |
Fields getConn :: Connection

data HieDbException #

Constructors

IncompatibleSchemaVersion |
Fields expectedVersion :: Integer gotVersion :: Integer

#### Instances

Instances details

Exception HieDbException # |
Instance details Defined in HieDb.Types Methods toException :: HieDbException -> SomeException # fromException :: SomeException -> Maybe HieDbException # displayException :: HieDbException -> String # backtraceDesired :: HieDbException -> Bool #
Show HieDbException # |
Instance details Defined in HieDb.Types Methods showsPrec :: Int -> HieDbException -> ShowS # show :: HieDbException -> String # showList :: [HieDbException] -> ShowS #
Eq HieDbException # |
Instance details Defined in HieDb.Types Methods (==) :: HieDbException -> HieDbException -> Bool # (/=) :: HieDbException -> HieDbException -> Bool #
Ord HieDbException # |
Instance details Defined in HieDb.Types Methods compare :: HieDbException -> HieDbException -> Ordering # (<) :: HieDbException -> HieDbException -> Bool # (<=) :: HieDbException -> HieDbException -> Bool # (>) :: HieDbException -> HieDbException -> Bool # (>=) :: HieDbException -> HieDbException -> Bool # max :: HieDbException -> HieDbException -> HieDbException # min :: HieDbException -> HieDbException -> HieDbException #

setHieTrace :: HieDb -> Maybe (Text -> IO ()) -> IO () #

data SourceFile #

Encodes the original haskell source file of a module, along with whether it is "real" or not A file is "real" if it comes from the user project, as opposed to a dependency

Constructors

RealFile FilePath |
FakeFile (Maybe FilePath) |

data ModuleInfo #

Constructors

ModuleInfo |
Fields modInfoName :: ModuleName modInfoUnit :: Unit Identifies the package this module is part of modInfoIsBoot :: Bool True, when this ModuleInfo was created by indexing `.hie-boot` file; False when it was created from `.hie` file modInfoSrcFile :: Maybe FilePath The path to the haskell source file, from which the `.hie` file was created modInfoIsReal :: Bool Is this a real source file? I.e. does it come from user's project (as opposed to from project's dependency)? modInfoHash :: Fingerprint The hash of the `.hie` file from which this ModuleInfo was created

#### Instances

Instances details

Show ModuleInfo # |
Instance details Defined in HieDb.Types Methods showsPrec :: Int -> ModuleInfo -> ShowS # show :: ModuleInfo -> String # showList :: [ModuleInfo] -> ShowS #
Eq ModuleInfo # |
Instance details Defined in HieDb.Types Methods (==) :: ModuleInfo -> ModuleInfo -> Bool # (/=) :: ModuleInfo -> ModuleInfo -> Bool #
FromRow ModuleInfo # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser ModuleInfo #
ToRow ModuleInfo # |
Instance details Defined in HieDb.Types Methods toRow :: ModuleInfo -> [SQLData] #

type Res a = a :. ModuleInfo #

toNsChar :: NameSpace -> String #

fromNsChar :: Text -> Maybe NameSpace #

data HieModuleRow #

Constructors

HieModuleRow |
Fields hieModuleHieFile :: FilePath Full path to `.hie` file based on which this row was created hieModInfo :: ModuleInfo

#### Instances

Instances details

Show HieModuleRow # |
Instance details Defined in HieDb.Types Methods showsPrec :: Int -> HieModuleRow -> ShowS # show :: HieModuleRow -> String # showList :: [HieModuleRow] -> ShowS #
Eq HieModuleRow # |
Instance details Defined in HieDb.Types Methods (==) :: HieModuleRow -> HieModuleRow -> Bool # (/=) :: HieModuleRow -> HieModuleRow -> Bool #
FromRow HieModuleRow # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser HieModuleRow #
ToRow HieModuleRow # |
Instance details Defined in HieDb.Types Methods toRow :: HieModuleRow -> [SQLData] #

data RefRow #

Constructors

RefRow |
Fields refSrc :: FilePath refNameOcc :: OccName refNameMod :: ModuleName refNameUnit :: Unit refSLine :: Int refSCol :: Int refELine :: Int refECol :: Int

#### Instances

Instances details

FromRow RefRow # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser RefRow #
ToRow RefRow # |
Instance details Defined in HieDb.Types Methods toRow :: RefRow -> [SQLData] #

data DeclRow #

Constructors

DeclRow |
Fields declSrc :: FilePath declNameOcc :: OccName declSLine :: Int declSCol :: Int declELine :: Int declECol :: Int declRoot :: Bool

#### Instances

Instances details

FromRow DeclRow # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser DeclRow #
ToRow DeclRow # |
Instance details Defined in HieDb.Types Methods toRow :: DeclRow -> [SQLData] #

data ImportRow #

Constructors

ImportRow |
Fields importSrc :: FilePath importModuleName :: ModuleName importSLine :: Int importSCol :: Int importELine :: Int importECol :: Int

#### Instances

Instances details

FromRow ImportRow # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser ImportRow #
ToRow ImportRow # |
Instance details Defined in HieDb.Types Methods toRow :: ImportRow -> [SQLData] #

data TypeName #

Constructors

TypeName |
Fields typeName :: OccName typeMod :: ModuleName typeUnit :: Unit

data TypeRef #

Constructors

TypeRef |
Fields typeRefOccId :: Int64 typeRefHieFile :: FilePath typeRefDepth :: Int typeRefSLine :: Int typeRefSCol :: Int typeRefELine :: Int typeRefECol :: Int

#### Instances

Instances details

FromRow TypeRef # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser TypeRef #
ToRow TypeRef # |
Instance details Defined in HieDb.Types Methods toRow :: TypeRef -> [SQLData] #

data DefRow #

Constructors

DefRow |
Fields defSrc :: FilePath defNameOcc :: OccName defSLine :: Int defSCol :: Int defELine :: Int defECol :: Int

#### Instances

Instances details

FromRow DefRow # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser DefRow #
ToRow DefRow # |
Instance details Defined in HieDb.Types Methods toRow :: DefRow -> [SQLData] #

data ExportRow #

Constructors

ExportRow |
Fields exportHieFile :: FilePath Exporting module exportName :: OccName exportMod :: ModuleName Definition module exportUnit :: Unit exportParent :: Maybe OccName exportParentMod :: Maybe ModuleName exportParentUnit :: Maybe Unit exportIsDatacon :: Bool

#### Instances

Instances details

FromRow ExportRow # |
Instance details Defined in HieDb.Types Methods fromRow :: RowParser ExportRow #
ToRow ExportRow # |
Instance details Defined in HieDb.Types Methods toRow :: ExportRow -> [SQLData] #

class Monad m => NameCacheMonad (m :: Type -> Type) where #

Monad with access to `NameCacheUpdater`, which is needed to deserialize `.hie` files

Methods

getNcUpdater :: m NameCacheUpdater #

#### Instances

Instances details

MonadIO m => NameCacheMonad (DbMonadT m) # |
Instance details Defined in HieDb.Types Methods getNcUpdater :: DbMonadT m NameCacheUpdater #

newtype DbMonadT (m :: Type -> Type) a #

Constructors

DbMonadT |
Fields runDbMonad :: ReaderT (IORef NameCache) m a

#### Instances

Instances details

MonadTrans DbMonadT # |
Instance details Defined in HieDb.Types Methods lift :: Monad m => m a -> DbMonadT m a #
MonadIO m => MonadIO (DbMonadT m) # |
Instance details Defined in HieDb.Types Methods liftIO :: IO a -> DbMonadT m a #
Monad m => Applicative (DbMonadT m) # |
Instance details Defined in HieDb.Types Methods pure :: a -> DbMonadT m a # (<*>) :: DbMonadT m (a -> b) -> DbMonadT m a -> DbMonadT m b # liftA2 :: (a -> b -> c) -> DbMonadT m a -> DbMonadT m b -> DbMonadT m c # (*>) :: DbMonadT m a -> DbMonadT m b -> DbMonadT m b # (<*) :: DbMonadT m a -> DbMonadT m b -> DbMonadT m a #
Monad m => Functor (DbMonadT m) # |
Instance details Defined in HieDb.Types Methods fmap :: (a -> b) -> DbMonadT m a -> DbMonadT m b # (<$) :: a -> DbMonadT m b -> DbMonadT m a #
Monad m => Monad (DbMonadT m) # |
Instance details Defined in HieDb.Types Methods (>>=) :: DbMonadT m a -> (a -> DbMonadT m b) -> DbMonadT m b # (>>) :: DbMonadT m a -> DbMonadT m b -> DbMonadT m b # return :: a -> DbMonadT m a #
MonadIO m => NameCacheMonad (DbMonadT m) # |
Instance details Defined in HieDb.Types Methods getNcUpdater :: DbMonadT m NameCacheUpdater #

type DbMonad = DbMonadT IO #

runDbM :: IORef NameCache -> DbMonad a -> IO a #

data HieDbErr #

Constructors

NotIndexed ModuleName (Maybe Unit) |
AmbiguousUnitId (NonEmpty ModuleInfo) |
NameNotFound OccName (Maybe ModuleName) (Maybe Unit) |
NoNameAtPoint HieTarget (Int, Int) |
NameUnhelpfulSpan Name String |

data Symbol #

Constructors

Symbol |
Fields symName :: !OccName symModule :: !Module

#### Instances

Instances details

Read Symbol # |
Instance details Defined in HieDb.Types Methods readsPrec :: Int -> ReadS Symbol # readList :: ReadS [Symbol] # readPrec :: ReadPrec Symbol # readListPrec :: ReadPrec [Symbol] #
Show Symbol # |
Instance details Defined in HieDb.Types Methods showsPrec :: Int -> Symbol -> ShowS # show :: Symbol -> String # showList :: [Symbol] -> ShowS #
Eq Symbol # |
Instance details Defined in HieDb.Types Methods (==) :: Symbol -> Symbol -> Bool # (/=) :: Symbol -> Symbol -> Bool #
Ord Symbol # |
Instance details Defined in HieDb.Types Methods compare :: Symbol -> Symbol -> Ordering # (<) :: Symbol -> Symbol -> Bool # (<=) :: Symbol -> Symbol -> Bool # (>) :: Symbol -> Symbol -> Bool # (>=) :: Symbol -> Symbol -> Bool # max :: Symbol -> Symbol -> Symbol # min :: Symbol -> Symbol -> Symbol #

readNameSpace :: ReadP NameSpace #

readColon :: ReadP () #

readSymbol :: ReadP Symbol #

newtype LibDir #

GHC Library Directory. Typically you'll want to use `libdir` from ghc-paths

Constructors

LibDir FilePath |

type HieTarget = Either FilePath (ModuleName, Maybe Unit) #

A way to specify which HieFile to operate on. Either the path to `.hie` file is given in the Left Or ModuleName (with optional Unit) is given in the Right

# Orphan instances

FromField OccName # |
Instance details Methods fromField :: FieldParser OccName #
FromField Unit # |
Instance details Methods fromField :: FieldParser Unit #
FromField ModuleName # |
Instance details Methods fromField :: FieldParser ModuleName #
FromField Fingerprint # |
Instance details Methods fromField :: FieldParser Fingerprint #
FromRow ModuleName # |
Instance details Methods fromRow :: RowParser ModuleName #
ToField OccName # |
Instance details Methods toField :: OccName -> SQLData #
ToField Unit # |
Instance details Methods toField :: Unit -> SQLData #
ToField ModuleName # |
Instance details Methods toField :: ModuleName -> SQLData #
ToField Fingerprint # |
Instance details Methods toField :: Fingerprint -> SQLData #