darcs-2.18.2: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Repository.InternalTypes

Synopsis

- data Repository (rt :: AccessType) (p :: Type -> Type -> Type) wU wR
- data PristineType
  - = NoPristine
  - | PlainPristine
  - | HashedPristine
- data AccessType
  - = RO
  - | RW
- data SAccessType (rt :: AccessType) where
  - SRO :: SAccessType 'RO
  - SRW :: SAccessType 'RW
- repoAccessType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> SAccessType rt
- repoCache :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> Cache
- modifyCache :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. (Cache -> Cache) -> Repository rt p wU wR -> Repository rt p wU wR
- repoFormat :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> RepoFormat
- modifyRepoFormat :: forall (p :: Type -> Type -> Type) wU wR. (RepoFormat -> RepoFormat) -> Repository 'RW p wU wR -> IO (Repository 'RW p wU wR)
- repoLocation :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> String
- withRepoDir :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR a. Repository rt p wU wR -> IO a -> IO a
- repoPristineType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> PristineType
- unsafeCoerceRepoType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR (rt' :: AccessType). Repository rt p wU wR -> Repository rt' p wU wR
- unsafeCoercePatchType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR (p' :: Type -> Type -> Type). Repository rt p wU wR -> Repository rt p' wU wR
- unsafeCoerceR :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR wR'. Repository rt p wU wR -> Repository rt p wU wR'
- unsafeCoerceU :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR wU'. Repository rt p wU wR -> Repository rt p wU' wR
- unsafeEndTransaction :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RW p wU wR -> Repository 'RO p wU wR
- unsafeStartTransaction :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RO p wU wR -> Repository 'RW p wU wR
- mkRepo :: forall (p :: Type -> Type -> Type) wU wR. AbsoluteOrRemotePath -> RepoFormat -> PristineType -> Cache -> Repository 'RO p wU wR

# Documentation

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

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 PristineType #

Constructors

NoPristine |
PlainPristine |
HashedPristine |

#### Instances

Instances details

Show PristineType # |
Instance details Defined in Darcs.Repository.InternalTypes Methods showsPrec :: Int -> PristineType -> ShowS # show :: PristineType -> String # showList :: [PristineType] -> ShowS #
Eq PristineType # |
Instance details Defined in Darcs.Repository.InternalTypes Methods (==) :: PristineType -> PristineType -> Bool # (/=) :: PristineType -> PristineType -> Bool #

data AccessType #

Constructors

RO |
RW |

#### Instances

Instances details

Eq AccessType # |
Instance details Defined in Darcs.Repository.InternalTypes Methods (==) :: AccessType -> AccessType -> Bool # (/=) :: AccessType -> AccessType -> Bool #

data SAccessType (rt :: AccessType) where #

Constructors

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

repoAccessType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> SAccessType rt #

repoCache :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> Cache #

modifyCache :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. (Cache -> Cache) -> Repository rt p wU wR -> Repository rt p wU wR #

repoFormat :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> RepoFormat #

modifyRepoFormat :: forall (p :: Type -> Type -> Type) wU wR. (RepoFormat -> RepoFormat) -> Repository 'RW p wU wR -> IO (Repository 'RW p wU wR) #

repoLocation :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> String #

withRepoDir :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR a. Repository rt p wU wR -> IO a -> IO a #

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

repoPristineType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> PristineType #

unsafeCoerceRepoType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR (rt' :: AccessType). Repository rt p wU wR -> Repository rt' p wU wR #

unsafeCoercePatchType :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR (p' :: Type -> Type -> Type). Repository rt p wU wR -> Repository rt p' wU wR #

unsafeCoerceR :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR wR'. Repository rt p wU wR -> Repository rt p wU wR' #

unsafeCoerceU :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR wU'. Repository rt p wU wR -> Repository rt p wU' wR #

unsafeEndTransaction :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RW p wU wR -> Repository 'RO p wU wR #

unsafeStartTransaction :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RO p wU wR -> Repository 'RW p wU wR #

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.

mkRepo :: forall (p :: Type -> Type -> Type) wU wR. AbsoluteOrRemotePath -> RepoFormat -> PristineType -> Cache -> Repository 'RO p wU wR #