type alias cleanup

This commit is contained in:
Joey Hess 2011-12-31 04:11:39 -04:00
parent a2ec2d3760
commit 4a02c2ea62
38 changed files with 129 additions and 122 deletions

View file

@ -19,22 +19,22 @@ import Types.UUID
type RemoteConfig = M.Map String String
{- There are different types of remotes. -}
data RemoteType a = RemoteType {
data RemoteTypeA a = RemoteType {
-- human visible type name
typename :: String,
-- enumerates remotes of this type
enumerate :: a [Git.Repo],
-- generates a remote of this type
generate :: Git.Repo -> UUID -> Maybe RemoteConfig -> a (Remote a),
generate :: Git.Repo -> UUID -> Maybe RemoteConfig -> a (RemoteA a),
-- initializes or changes a remote
setup :: UUID -> RemoteConfig -> a RemoteConfig
}
instance Eq (RemoteType a) where
instance Eq (RemoteTypeA a) where
x == y = typename x == typename y
{- An individual remote. -}
data Remote a = Remote {
data RemoteA a = Remote {
-- each Remote has a unique uuid
uuid :: UUID,
-- each Remote has a human visible name
@ -58,16 +58,16 @@ data Remote a = Remote {
-- git configuration for the remote
repo :: Git.Repo,
-- the type of the remote
remotetype :: RemoteType a
remotetype :: RemoteTypeA a
}
instance Show (Remote a) where
instance Show (RemoteA a) where
show remote = "Remote { name =\"" ++ name remote ++ "\" }"
-- two remotes are the same if they have the same uuid
instance Eq (Remote a) where
instance Eq (RemoteA a) where
x == y = uuid x == uuid y
-- order remotes by cost
instance Ord (Remote a) where
instance Ord (RemoteA a) where
compare = comparing cost