-- Copyright (C) 2006-2007 David Roundy---- This program is free software; you can redistribute it and/or modify-- it under the terms of the GNU General Public License as published by-- the Free Software Foundation; either version 2, or (at your option)-- any later version.---- This program is distributed in the hope that it will be useful,-- but WITHOUT ANY WARRANTY; without even the implied warranty of-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-- GNU General Public License for more details.---- You should have received a copy of the GNU General Public License-- along with this program; if not, write to the Free Software Foundation,-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.{-# LANGUAGE CPP #-}#include "gadts.h"moduleDarcs.Repository.InternalTypes(Repository(..),RepoType(..),Pristine(..),extractCache,extractOptions,modifyCache)whereimportData.List(nub,sortBy)importDarcs.Repository.Cache(Cache(..),compareByLocality)importDarcs.Flags(DarcsFlag)importDarcs.Repository.Format(RepoFormat)importDarcs.Patch(RepoPatch)dataPristine=NoPristine|PlainPristine|HashedPristinederiving(Show,Eq)dataRepository(p::*C(->*->*))C(recordedstateunrecordedstatetentativestate)=Repo!String![DarcsFlag]!RepoFormat!(RepoTypep)deriving(Show)dataRepoType(p::*C(->*->*))=DarcsRepository!PristineCachederiving(Show)extractCache::RepositorypC(rut)->CacheextractCache(Repo___(DarcsRepository_c))=cextractOptions::RepositorypC(rut)->[DarcsFlag]extractOptions(Repo_opts__)=opts-- | 'modifyCache' @repository function@ modifies the cache of-- @repository@ with @function@, remove duplicates and sort the results with 'compareByLocality'.modifyCache::FORALL(prut)(RepoPatchp)=>RepositorypC(rut)->(Cache->Cache)->RepositorypC(rut)modifyCache(Repodiroptsrf(DarcsRepositorypristinecache))f=Repodiroptsrfdrwheredr=DarcsRepositorypristine.cmap(sortBycompareByLocality.nub)$fcachecmapg(Cac)=Ca(gc)