moduleDarcs.Patch.Prim.Class(PrimConstruct(..),PrimCanonize(..),PrimClassify(..),PrimDetails(..),PrimShow(..),showPrimFL,PrimRead(..),PrimApply(..),PrimPatch,PrimPatchBase(..),FromPrim(..),FromPrims(..),ToFromPrim(..))whereimportDarcs.Patch.ApplyMonad(ApplyMonad)importDarcs.Patch.Apply(ApplyState)importDarcs.Patch.FileHunk(FileHunk,IsHunk)importDarcs.Patch.FileName(FileName)importDarcs.Patch.Format(PatchListFormat,FileNameFormat(..))importDarcs.Patch.Patchy(Patchy)importDarcs.Patch.ReadMonads(ParserM)importDarcs.Patch.Repair(RepairToFL)importDarcs.Patch.SummaryData(SummDetail)importDarcs.Witnesses.Ordered(FL(..),RL,(:>),mapFL,mapFL_FL,concatFL,reverseFL,concatRL)importDarcs.Witnesses.Sealed(Sealed)importPrinter(Doc,vcat)importqualifiedData.ByteStringasB(ByteString)#include "gadts.h"class(Patchyprim,PatchListFormatprim,IsHunkprim,RepairToFLprim,PrimConstructprim,PrimCanonizeprim,PrimClassifyprim,PrimDetailsprim,PrimShowprim,PrimReadprim,PrimApplyprim)=>PrimPatchprimclassPrimPatch(PrimOfp)=>PrimPatchBasepwheretypePrimOf(p::PATCHKIND)::PATCHKINDinstancePrimPatchBasep=>PrimPatchBase(FLp)wheretypePrimOf(FLp)=PrimOfpinstancePrimPatchBasep=>PrimPatchBase(RLp)wheretypePrimOf(RLp)=PrimOfpclassFromPrimpwherefromPrim::PrimOfpC(xy)->pC(xy)classFromPrimp=>ToFromPrimpwheretoPrim::pC(xy)->Maybe(PrimOfpC(xy))classFromPrimspwherefromPrims::FL(PrimOfp)C(xy)->pC(xy)joinPatches::FLpC(xy)->pC(xy)instanceFromPrimp=>FromPrim(FLp)wherefromPrimp=fromPrimp:>:NilFLinstanceFromPrimp=>FromPrims(FLp)wherefromPrims=mapFL_FLfromPrimjoinPatches=concatFLinstanceFromPrimp=>FromPrims(RLp)wherefromPrims=reverseFL.mapFL_FLfromPrimjoinPatches=concatRL.reverseFLclassPrimClassifyprimwhereprimIsAddfile::primC(xy)->BoolprimIsRmfile::primC(xy)->BoolprimIsAdddir::primC(xy)->BoolprimIsRmdir::primC(xy)->BoolprimIsMove::primC(xy)->BoolprimIsHunk::primC(xy)->BoolprimIsTokReplace::primC(xy)->BoolprimIsBinary::primC(xy)->BoolprimIsSetpref::primC(xy)->Boolis_filepatch::primC(xy)->MaybeFileNameclassPrimConstructprimwhereaddfile::FilePath->primC(xy)rmfile::FilePath->primC(xy)adddir::FilePath->primC(xy)rmdir::FilePath->primC(xy)move::FilePath->FilePath->primC(xy)changepref::String->String->String->primC(xy)hunk::FilePath->Int->[B.ByteString]->[B.ByteString]->primC(xy)tokreplace::FilePath->String->String->String->primC(xy)binary::FilePath->B.ByteString->B.ByteString->primC(xy)primFromHunk::FileHunkC(xy)->primC(xy)anIdentity::primC(xx)classPrimCanonizeprimwheretryToShrink::FLprimC(xy)->FLprimC(xy)tryShrinkingInverse::FLprimC(xy)->Maybe(FLprimC(xy))-- | 'sortCoalesceFL' @ps@ coalesces as many patches in @ps@ as-- possible, sorting the results in some standard order.sortCoalesceFL::FLprimC(xy)->FLprimC(xy)-- | It can sometimes be handy to have a canonical representation of a given-- patch. We achieve this by defining a canonical form for each patch type,-- and a function 'canonize' which takes a patch and puts it into-- canonical form. This routine is used by the diff function to create an-- optimal patch (based on an LCS algorithm) from a simple hunk describing the-- old and new version of a file.canonize::primC(xy)->FLprimC(xy)-- | 'canonizeFL' @ps@ puts a sequence of primitive patches into-- canonical form. Even if the patches are just hunk patches,-- this is not necessarily the same set of results as you would get-- if you applied the sequence to a specific tree and recalculated-- a diff.---- Note that this process does not preserve the commutation behaviour-- of the patches and is therefore not appropriate for use when-- working with already recorded patches (unless doing amend-record-- or the like).canonizeFL::FLprimC(xy)->FLprimC(xy)join::(prim:>prim)C(xy)->Maybe(FLprimC(xy))classPrimDetailsprimwheresummarizePrim::primC(xy)->[SummDetail]classPrimShowprimwhereshowPrim::FileNameFormat->primC(ab)->DocshowPrimFL::PrimShowprim=>FileNameFormat->FLprimC(ab)->DocshowPrimFLfxs=vcat(mapFL(showPrimf)xs)classPrimReadprimwherereadPrim::ParserMm=>FileNameFormat->m(Sealed(primC(x)))classPrimApplyprimwhereapplyPrimFL::ApplyMonadm(ApplyStateprim)=>FLprimC(xy)->m()