packages feed

stackage-to-hackage 1.1.0 → 1.1.1

raw patch · 2 files changed

+16/−9 lines, 2 filesdep ~directorydep ~optparse-applicative

Dependency ranges changed: directory, optparse-applicative

Files

lib/StackageToHackage/Stackage.hs view
@@ -20,9 +20,10 @@ import           Data.Maybe                   (fromMaybe, listToMaybe, mapMaybe) import           Data.Text                    (Text, isSuffixOf, replace,                                                takeWhile, unpack)-import           Data.YAML                    (FromYAML, decodeStrict,-                                               parseYAML, withMap, withStr,-                                               (.!=), (.:), (.:?))+import           Data.YAML                    (FromYAML, Mapping, Node (..),+                                               Parser, Scalar (..),+                                               decodeStrict, parseYAML, withMap,+                                               withStr, (.!=), (.:), (.:?)) import           Distribution.Text            (simpleParse) import           Distribution.Types.PackageId (PackageIdentifier (..)) import           Network.HTTP.Client          (httpLbs, parseRequest,@@ -137,7 +138,7 @@   either fail (\r -> pure (Nothing, r)) $ new2old <$> (decode1Strict $ text)     where       download =-        let path = unpack $ replace "." "/" (replace "-" "/" lts)+        let path = unpack $ replace "." "/" (replace "-" "/" (replace "-0" "-" lts))             raw = concat ["https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/", path, ".yaml"]         in do           manager <- getGlobalManager@@ -231,9 +232,15 @@  instance FromYAML NewResolver where   parseYAML = withMap "NewResolver" $ \m -> NewResolver-    <$> m .: "compiler"+    <$> (m .: "compiler" <|> m ..: ("resolver", "compiler"))     <*> m .:? "packages" .!= mempty     <*> m .:? "flags" .!= (Flags M.empty)+    where+      (..:) :: FromYAML a => Mapping -> (Text, Text) -> Parser a+      m1 ..: (k1, k2) =+        case M.lookup (Scalar (SStr k1)) m1 of+          Just (Mapping _ m2) -> m2 .: k2+          _ -> fail $ "key " ++ show k1 ++ " not found"  newtype PkgId = PkgId { unPkgId :: PackageIdentifier } deriving (Show) instance FromYAML PkgId where
stackage-to-hackage.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                stackage-to-hackage-version:             1.1.0+version:             1.1.1 synopsis:            Convert stack.yaml to cabal.project + cabal.project.freeze license:             GPL-3.0-or-later license-file:        LICENSE@@ -11,11 +11,11 @@ tested-with:         GHC ^>= 8.4.4 || ^>= 8.6.3 category:            Building description:-  A small library (and demo app) to convert stack.yaml files to cabal.project /-  cabal.project.freeze for an existing Haskell application that has its build plan+  A small library (and demo app) to convert @stack.yaml@ files to @cabal.project@ \/+  @cabal.project.freeze@ for an existing Haskell application that has its build plan   defined for the stack build tool.   .-  Users will want to use the stack2cabal application, integrating hpack support.+  Users will want to use the @stack2cabal@ application, integrating @hpack@ support.  -- https://www.haskell.org/cabal/users-guide/cabal-projectindex.html