stackage-to-hackage 1.0.0 → 1.0.1
raw patch · 3 files changed
+15/−13 lines, 3 files
Files
- src/Main.hs +1/−1
- src/Stackage.hs +11/−9
- stackage-to-hackage.cabal +3/−3
src/Main.hs view
@@ -97,7 +97,7 @@ genFreeze :: Resolver -> Freeze genFreeze Resolver{deps, flags} =- let pkgs = mapMaybe pick deps+ let pkgs = unPkgId <$> mapMaybe pick deps uniqpkgs = nubOn pkgName pkgs in Freeze uniqpkgs flags where pick (Hackage p) = Just p
src/Stackage.hs view
@@ -78,7 +78,7 @@ -- http://hackage.haskell.org/package/Cabal-2.4.1.0/docs/Distribution-Types-PackageId.html#t:PackageIdentifier -- http://hackage.haskell.org/package/Cabal-2.4.1.0/docs/Distribution-Parsec-Class.html#v:simpleParsec -data Dep = Hackage PackageIdentifier+data Dep = Hackage PkgId | SourceDep Git deriving (Show) @@ -97,7 +97,7 @@ , flags :: Flags } deriving (Show) -data NewDep = NewDep PackageIdentifier+data NewDep = NewDep PkgId deriving (Show) --------------------------------------------------------------------------------@@ -203,11 +203,10 @@ Location <$> m .: "location" instance FromYAML Dep where- parseYAML n = (hackage n) <|> (source n)+ parseYAML n = hackage <|> source where- hackage = withStr "Hackage" $ \s ->- Hackage <$> (hoistMaybe . simpleParse . unpack) s- source n' = SourceDep <$> parseYAML n'+ hackage = Hackage <$> parseYAML n+ source = SourceDep <$> parseYAML n instance FromYAML Resolver where parseYAML = withMap "Resolver" $ \m -> Resolver@@ -219,12 +218,15 @@ instance FromYAML NewDep where parseYAML = withMap "NewDep" $ \m -> hackage' =<< m .: "hackage" where- hackage' = \s -> NewDep <$>- (hoistMaybe . simpleParse . unpack)- (takeWhile ('@' /=) s)+ hackage' n = NewDep <$> parseYAML n instance FromYAML NewResolver where parseYAML = withMap "NewResolver" $ \m -> NewResolver <$> m .: "compiler" <*> m .:? "packages" .!= mempty <*> m .:? "flags" .!= (Flags empty)++newtype PkgId = PkgId { unPkgId :: PackageIdentifier } deriving (Show)+instance FromYAML PkgId where+ parseYAML = withStr "PackageIdentifier" $ \s ->+ PkgId <$> (hoistMaybe . simpleParse . unpack) (takeWhile ('@' /=) s)
stackage-to-hackage.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: stackage-to-hackage-version: 1.0.0+version: 1.0.1 synopsis: Convert stack.yaml to cabal.project + cabal.project.freeze license: GPL-3.0-or-later license-file: LICENSE@@ -15,8 +15,8 @@ for an existing Haskell application that has its build plan defined for the stack build tool. - The user can use the following script to invoke this binary and hpack:- [stack2cabal](https://gitlab.com/tseenshe/stackage-to-hackage/blob/master/stack2cabal).+ The following convenience script invokes stackage-to-hackage and hpack+ together [stack2cabal](https://gitlab.com/tseenshe/stackage-to-hackage/blob/master/stack2cabal). source-repository head type: git