@@ -25,18 +25,22 @@ makePrisms ''StackResolver
25unStackResolver :: StackResolver -> String
25unStackResolver :: StackResolver -> String
26unStackResolver = T.unpack . fromStackResolver
26unStackResolver = T.unpack . fromStackResolver
28−data RepoGit = RepoGit
28+newtype Vcs = Vcs { fromVcs :: Text }
29+ deriving (Eq, Ord, Show)
29− { _rgUri :: !Text
33+ , _rUri :: !Text
30− , _rgCommit :: !Text
34+ , _rCommit :: !Text
31 } deriving (Eq, Ord, Show)
35 } deriving (Eq, Ord, Show)
33−makeLenses ''RepoGit
37+makeLenses ''Repo
35data PackageLocation
39data PackageLocation
36 = HackagePackage Text
40 = HackagePackage Text
37 | StackFilePath FilePath
41 | StackFilePath FilePath
38 | StackUri URI
42 | StackUri URI
39− | StackRepoGit RepoGit
43+ | StackRepo Repo
40 deriving (Eq, Ord, Show)
44 deriving (Eq, Ord, Show)
42makePrisms ''PackageLocation
46makePrisms ''PackageLocation
@@ -72,18 +76,28 @@ fromYamlPackage = \case
72 Yaml.LocationSimple (Yaml.Location p extraDep) ->
76 Yaml.LocationSimple (Yaml.Location p extraDep) ->
73 StackPackage (parseSimplePath p) (fromMaybe False extraDep)
77 StackPackage (parseSimplePath p) (fromMaybe False extraDep)
74 Yaml.LocationGit (Location git extraDep) ->
78 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)
77 parseSimplePath (T.unpack -> p) = maybe (StackFilePath p) StackUri $ parseURI p
83 parseSimplePath (T.unpack -> p) = maybe (StackFilePath p) StackUri $ parseURI p
79fromYamlExtraDep :: Text -> StackPackage
85fromYamlExtraDep :: Text -> StackPackage
80fromYamlExtraDep = flip StackPackage True . HackagePackage
86fromYamlExtraDep = flip StackPackage True . HackagePackage
82−fromYamlGit :: Yaml.Git -> RepoGit
88+fromYamlGit :: Yaml.Git -> Repo
83−fromYamlGit yg = RepoGit{..}
89+fromYamlGit yg = Repo{..}
93+ _rCommit = yg ^. gCommit
95+fromYamlHg :: Yaml.Hg -> Repo
96+fromYamlHg yh = Repo{..}
85− _rgUri = yg ^. gGit
98+ _rVcs = Vcs "hg"
86− _rgCommit = yg ^. gCommit
99+ _rUri = yh ^. hHg
100+ _rCommit = yh ^. hCommit
88readStackConfig :: StackYaml -> IO (Either String StackConfig)
102readStackConfig :: StackYaml -> IO (Either String StackConfig)
89readStackConfig stackYaml = do
103readStackConfig stackYaml = do