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

Darcs.Patch.Non

Description

`NonPatch` and `Non` patches are patches that store a context as a sequence of patches. See Darcs.Patch.Real for example usage.

Synopsis

- data Non p where
  - Non :: FL p -> Prim -> Non p
- class Nonable p where
  - non :: p -> Non p
- unNon :: FromPrim p => Non p -> Sealed (FL p)
- showNon :: ShowPatch (FL p) => Non p -> Doc
- readNon :: (ReadPatch p, ParserM m) => m (Maybe (Non p))
- showNons :: ShowPatch (FL p) => [Non p] -> Doc
- readNons :: (ReadPatch p, ParserM m) => m [Non p]
- add :: (Effect q, Patchy p, ToFromPrim p) => q -> Non p -> Non p
- rem :: (Effect q, Patchy p, ToFromPrim p) => q -> Non p -> Maybe (Non p)
- addP :: (Patchy p, ToFromPrim p) => p -> Non p -> Non p
- remP :: (Patchy p, ToFromPrim p) => p -> Non p -> Maybe (Non p)
- addPs :: (Patchy p, ToFromPrim p) => RL p -> Non p -> Non p
- remPs :: (Patchy p, ToFromPrim p) => FL p -> Non p -> Maybe (Non p)
- remAddP :: (Patchy p, ToFromPrim p) => p -> Non p -> Non p
- remAddPs :: (Patchy p, ToFromPrim p) => RL p -> Non p -> Non p
- remNons :: (Nonable p, Effect p, Patchy p, ToFromPrim p, ShowPatch p) => [Non p] -> Non p -> Non p
- (*>) :: (Patchy p, ToFromPrim p) => Non p -> p -> Maybe (Non p)
- (>*) :: (Patchy p, ToFromPrim p) => p -> Non p -> Maybe (Non p)
- (*>>) :: (Effect q, Patchy q, Patchy p, ToFromPrim p) => Non p -> q -> Maybe (Non p)
- (>>*) :: (Effect q, Patchy p, ToFromPrim p) => q -> Non p -> Maybe (Non p)
- propAdjustTwice :: (Patchy p, ToFromPrim p) => p -> Non p -> Maybe Doc

# Documentation

data Non p where

`Non` stores a context with a `Prim` patch.

Constructors

Non :: FL p -> Prim -> Non p |

Instances

(Commute p, MyEq p) => Eq (Non p) |
Show2 p => Show (Non p) |
Show2 p => Show1 (Non p) |

class Nonable p where

Methods

non :: p -> Non p

Instances

Nonable Prim |
Nonable RealPatch |

unNon :: FromPrim p => Non p -> Sealed (FL p)

Return as a list the context followed by the primitive patch.

showNon :: ShowPatch (FL p) => Non p -> Doc

readNon :: (ReadPatch p, ParserM m) => m (Maybe (Non p))

showNons :: ShowPatch (FL p) => [Non p] -> Doc

readNons :: (ReadPatch p, ParserM m) => m [Non p]

add :: (Effect q, Patchy p, ToFromPrim p) => q -> Non p -> Non p

rem :: (Effect q, Patchy p, ToFromPrim p) => q -> Non p -> Maybe (Non p)

addP :: (Patchy p, ToFromPrim p) => p -> Non p -> Non p

`addP` `x cy` tries to commute `x` past `cy` and always returns some variant `cy'`. -- commutation suceeds, the variant is just straightforwardly the commuted versian. If commutation fails, the variant consists of `x` prepended to the context of `cy`.

remP :: (Patchy p, ToFromPrim p) => p -> Non p -> Maybe (Non p)

addPs :: (Patchy p, ToFromPrim p) => RL p -> Non p -> Non p

`addPs` `xs cy` commutes as many patches of `xs` past `cy` as possible, stopping at the first patch that fails to commute. Note the fact `xs` is a `RL`

Suppose we have

     x1 x2 x3 [c1 c2 y]

and that in our example `c1` fails to commute past `x1`, this function would commute down to

     x1 [c1'' c2'' y''] x2' x3'

and return `[x1 c1'' c2'' y'']`

remPs :: (Patchy p, ToFromPrim p) => FL p -> Non p -> Maybe (Non p)

remAddP :: (Patchy p, ToFromPrim p) => p -> Non p -> Non p

remAddPs :: (Patchy p, ToFromPrim p) => RL p -> Non p -> Non p

remNons :: (Nonable p, Effect p, Patchy p, ToFromPrim p, ShowPatch p) => [Non p] -> Non p -> Non p

(*>) :: (Patchy p, ToFromPrim p) => Non p -> p -> Maybe (Non p)

(>*) :: (Patchy p, ToFromPrim p) => p -> Non p -> Maybe (Non p)

(*>>) :: (Effect q, Patchy q, Patchy p, ToFromPrim p) => Non p -> q -> Maybe (Non p)

(>>*) :: (Effect q, Patchy p, ToFromPrim p) => q -> Non p -> Maybe (Non p)

propAdjustTwice :: (Patchy p, ToFromPrim p) => p -> Non p -> Maybe Doc