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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Object

Synopsis

- type family ObjectIdOf (state :: (Type -> Type) -> Type)
- class Eq oid => ObjectId oid where
  - formatObjectId :: FileNameFormat -> oid -> Doc
- formatFileName :: FileNameFormat -> AnchoredPath -> Doc
- ap2fp :: AnchoredPath -> FilePath

# Documentation

type family ObjectIdOf (state :: (Type -> Type) -> Type) #

Given a state type (parameterized over a monad m :: * -> *), this gives us the type of the key with which we can lookup an item (or object) in the state.

#### Instances

Instances details

type ObjectIdOf ObjectMap # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.ObjectMap type ObjectIdOf ObjectMap = UUID
type ObjectIdOf Tree # |
Instance details Defined in Darcs.Patch.Object type ObjectIdOf Tree = AnchoredPath

class Eq oid => ObjectId oid where #

We require from such a key (an `ObjectId`) that it has a canonical way to format itself to a `Doc`. For historical reasons, this takes a parameter of type `FileNameFormat`.

Methods

formatObjectId :: FileNameFormat -> oid -> Doc #

#### Instances

Instances details

ObjectId AnchoredPath # |
Instance details Defined in Darcs.Patch.Object Methods formatObjectId :: FileNameFormat -> AnchoredPath -> Doc #

formatFileName :: FileNameFormat -> AnchoredPath -> Doc #

Format a `AnchoredPath` to a `Doc` according to the given `FileNameFormat`.

NOTE: This is not only used for display but also to format patch files. This is why we have to do the white space encoding here. See `writePatchIfNecessary`.

Besides white space encoding, for `FileNameFormatV2` we just pack it into a `Doc`. For `FileNameFormatV1` we must emulate the non-standard darcs-1 encoding of file paths: it is an UTF8 encoding of the raw byte stream, interpreted as code points.

See also `readFileName`.

ap2fp :: AnchoredPath -> FilePath #