darcs-2.18.3: a distributed, interactive, smart revision control system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Darcs.Repository.InternalTypes

Synopsis

Documentation

data Repository (rt :: AccessType) (p :: * -> * -> *) wU wR Source #

A Repository is a token representing the state of a repository on disk. It is parameterized by

rt
the access type (whether we are in a transaction or not),
p
the patch type,
wU
the witness for the unrecorded state (what's in the working tree now).
wR
the witness for
  • the recorded state when outside a transaction, or
  • the tentative state when inside a transaction.

data AccessType Source #

Constructors

RO 
RW 

Instances

Instances details
Eq AccessType Source # 
Instance details

Defined in Darcs.Repository.InternalTypes

data SAccessType (rt :: AccessType) where Source #

Constructors

SRO :: SAccessType 'RO 
SRW :: SAccessType 'RW 

repoCache :: Repository rt p wU wR -> Cache Source #

modifyCache :: (Cache -> Cache) -> Repository rt p wU wR -> Repository rt p wU wR Source #

withRepoDir :: Repository rt p wU wR -> IO a -> IO a Source #

Perform an action with the current working directory set to the repoLocation.

unsafeCoerceRepoType :: Repository rt p wU wR -> Repository rt' p wU wR Source #

unsafeCoercePatchType :: Repository rt p wU wR -> Repository rt p' wU wR Source #

unsafeCoerceR :: Repository rt p wU wR -> Repository rt p wU wR' Source #

unsafeCoerceU :: Repository rt p wU wR -> Repository rt p wU' wR Source #

unsafeStartTransaction :: Repository 'RO p wU wR -> Repository 'RW p wU wR Source #

Both unsafeStartTransaction and unsafeEndTransaction are "unsafe" in the sense that they merely "coerce" the type but do not actually perform the steps (IO actions) required to start or end a transaction (this is done by revertRepositoryChanges and finalizeRepositoryChanges). Technically this is not an actual coercion like with e.g. unsafeCoerceR, due to the singleton typed member, but in practical terms it is no less unsafe, because RO vs. RW changes whether wR refers to the recorded or the tentative state, respectively. In particular, you will get different results if you are inside a transaction and read the patchset with a "coerced" Repository of access type 'RO. The same holds for other state that is modified in a transaction, like the pending patch or the rebase state.