{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-| Description: Internal type stuff. Caveat emptor. -} 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 -- | Checksums. type Crc32 = Word32 -- | The index for a 'PackFile'. 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) -- | Representation of a parsed pack file. data PackFile = PackFile { getPackFile :: BL.ByteString, getIndex :: PackIndex } deriving (Eq, Ord, Show) -- | Configuration state for 'GitT'. data GitConf = GitConf { gitDir :: RawFilePath , packs :: [PackFile] } deriving (Eq, Ord, Show) -- | A Git monad transformer that writes loose objects. newtype GitT m a = GitT { unGitT :: StateT GitConf m a } deriving (Functor, Applicative, Monad, MonadIO, MonadState GitConf, MonadThrow, MonadCatch, MonadTrans, MonadFail)