{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Data.Git.Internal.Types where
import Control.Monad.Catch (MonadCatch, MonadThrow)
import Control.Monad.Fail
import Control.Monad.State
import qualified Data.ByteString.Lazy as BL
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as UV
import Data.Word
import System.Posix.FilePath (RawFilePath)
import Data.Git.Hash
type Crc32 = Word32
data PackIndex = PackIndex {
fanout :: UV.Vector Word32
, indexShas :: V.Vector Sha1
, shaCrcs :: UV.Vector Crc32
, shaOffsets :: UV.Vector Word32
, shaBigOffsets :: UV.Vector Word64
} deriving (Eq, Ord, Show)
data PackFile = PackFile { getPackFile :: BL.ByteString, getIndex :: PackIndex }
deriving (Eq, Ord, Show)
data GitConf = GitConf {
gitDir :: RawFilePath
, packs :: [PackFile]
} deriving (Eq, Ord, Show)
newtype GitT m a = GitT { unGitT :: StateT GitConf m a }
deriving (Functor, Applicative, Monad, MonadIO, MonadState GitConf,
MonadThrow, MonadCatch, MonadTrans, MonadFail)