@@ -25,18 +25,22 @@ makePrisms ''StackResolver
2525unStackResolver :: StackResolver -> String
2626unStackResolver = T.unpack . fromStackResolver
2727
28−data RepoGit = RepoGit
29− { _rgUri :: !Text
30− , _rgCommit :: !Text
28+newtype Vcs = Vcs { fromVcs :: Text }
29+ deriving (Eq, Ord, Show)
30+
31+data Repo = Repo
32+ { _rVcs :: !Vcs
33+ , _rUri :: !Text
34+ , _rCommit :: !Text
3135 } deriving (Eq, Ord, Show)
3236
33−makeLenses ''RepoGit
37+makeLenses ''Repo
3438
3539data PackageLocation
3640 = HackagePackage Text
3741 | StackFilePath FilePath
3842 | StackUri URI
39− | StackRepoGit RepoGit
43+ | StackRepo Repo
4044 deriving (Eq, Ord, Show)
4145
4246makePrisms ''PackageLocation
@@ -72,18 +76,28 @@ fromYamlPackage = \case
7276 Yaml.LocationSimple (Yaml.Location p extraDep) ->
7377 StackPackage (parseSimplePath p) (fromMaybe False extraDep)
7478 Yaml.LocationGit (Location git extraDep) ->
75− StackPackage (StackRepoGit $ fromYamlGit git) (fromMaybe False extraDep)
79+ StackPackage (StackRepo $ fromYamlGit git) (fromMaybe False extraDep)
80+ Yaml.LocationHg (Location hg extraDep) ->
81+ StackPackage (StackRepo $ fromYamlHg hg) (fromMaybe False extraDep)
7682 where
7783 parseSimplePath (T.unpack -> p) = maybe (StackFilePath p) StackUri $ parseURI p
7884
7985fromYamlExtraDep :: Text -> StackPackage
8086fromYamlExtraDep = flip StackPackage True . HackagePackage
8187
82−fromYamlGit :: Yaml.Git -> RepoGit
83−fromYamlGit yg = RepoGit{..}
88+fromYamlGit :: Yaml.Git -> Repo
89+fromYamlGit yg = Repo{..}
90+ where
91+ _rVcs = Vcs "git"
92+ _rUri = yg ^. gGit
93+ _rCommit = yg ^. gCommit
94+
95+fromYamlHg :: Yaml.Hg -> Repo
96+fromYamlHg yh = Repo{..}
8497 where
85− _rgUri = yg ^. gGit
86− _rgCommit = yg ^. gCommit
98+ _rVcs = Vcs "hg"
99+ _rUri = yh ^. hHg
100+ _rCommit = yh ^. hCommit
87101
88102readStackConfig :: StackYaml -> IO (Either String StackConfig)
89103readStackConfig stackYaml = do