Commit 91a2367e authored by Ryan Scott's avatar Ryan Scott

Add Cabal-2.4.1.0 patch, migrate yesod-core patch

* Add a patch for `Cabal-2.4.1.0`. While this is not the most recent
  release of `Cabal`, it still appears in many build plans, so it is
  useful to patch.
* Migrate the `yesod-core` patch to the latest Hackage release.
parent 82815489
Pipeline #9987 passed with stages
in 109 minutes and 24 seconds
This diff is collapsed.
diff -ru Cabal-2.4.1.0.orig/Distribution/Compat/ReadP.hs Cabal-2.4.1.0/Distribution/Compat/ReadP.hs
--- Cabal-2.4.1.0.orig/Distribution/Compat/ReadP.hs 1969-12-31 19:00:00.000000000 -0500
+++ Cabal-2.4.1.0/Distribution/Compat/ReadP.hs 2019-09-08 08:28:12.262274000 -0400
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
-----------------------------------------------------------------------------
-- |
@@ -113,7 +114,9 @@
(Result x p) >>= k = k x `mplus` (p >>= k)
(Final r) >>= k = final [ys' | (x,s) <- r, ys' <- run (k x) s]
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
+#endif
instance Fail.MonadFail (P s) where
fail _ = Fail
@@ -172,7 +175,9 @@
instance Monad (Parser r s) where
return = pure
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
+#endif
R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k))
instance Fail.MonadFail (Parser r s) where
diff -ru Cabal-2.4.1.0.orig/Distribution/Parsec/Class.hs Cabal-2.4.1.0/Distribution/Parsec/Class.hs
--- Cabal-2.4.1.0.orig/Distribution/Parsec/Class.hs 1969-12-31 19:00:00.000000000 -0500
+++ Cabal-2.4.1.0/Distribution/Parsec/Class.hs 2019-09-08 08:31:12.836405979 -0400
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
@@ -55,7 +56,7 @@
--
-- * knows @cabal-version@ we work with
--
-class (P.CharParsing m, MonadPlus m) => CabalParsing m where
+class (P.CharParsing m, MonadPlus m, Fail.MonadFail m) => CabalParsing m where
parsecWarning :: PWarnType -> String -> m ()
parsecHaskellString :: m String
@@ -116,7 +117,9 @@
(>>) = (*>)
{-# INLINE (>>) #-}
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
+#endif
instance MonadPlus ParsecParser where
mzero = empty
diff -ru Cabal-2.4.1.0.orig/Distribution/ParseUtils.hs Cabal-2.4.1.0/Distribution/ParseUtils.hs
--- Cabal-2.4.1.0.orig/Distribution/ParseUtils.hs 1969-12-31 19:00:00.000000000 -0500
+++ Cabal-2.4.1.0/Distribution/ParseUtils.hs 2019-09-08 08:31:47.628803805 -0400
@@ -19,6 +19,7 @@
-- This module is meant to be local-only to Distribution...
{-# OPTIONS_HADDOCK hide #-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE Rank2Types #-}
module Distribution.ParseUtils (
LineNo, PError(..), PWarning(..), locatedErrorMsg, syntaxError, warning,
@@ -107,7 +108,9 @@
ParseOk ws x >>= f = case f x of
ParseFailed err -> ParseFailed err
ParseOk ws' x' -> ParseOk (ws'++ws) x'
+#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
+#endif
instance Fail.MonadFail ParseResult where
fail s = ParseFailed (FromString s Nothing)
diff -ru Cabal-2.4.1.0.orig/Distribution/Simple/PreProcess.hs Cabal-2.4.1.0/Distribution/Simple/PreProcess.hs
--- Cabal-2.4.1.0.orig/Distribution/Simple/PreProcess.hs 1969-12-31 19:00:00.000000000 -0500
+++ Cabal-2.4.1.0/Distribution/Simple/PreProcess.hs 2019-09-08 08:26:37.233096478 -0400
@@ -122,6 +122,12 @@
-- preprocessor's output name format.
type PreProcessorExtras = FilePath -> IO [FilePath]
+-- | A newtype around 'PreProcessorExtras', useful for storing
+-- 'PreProcessorExtras' inside of another type constructor (e.g., a list)
+-- without impredicativity (recall that the 'IO' type, which is contained in
+-- 'PreProcessorExtras', is a synonym for @'HasCallStack' => Prelude.IO@, which
+-- is a polymorphic type).
+newtype WrappedPreProcessorExtras = WrapPPE { unWrapPPE :: PreProcessorExtras }
mkSimplePreProcessor :: (FilePath -> FilePath -> Verbosity -> IO ())
-> (FilePath, FilePath)
@@ -694,8 +700,8 @@
]
-- |Standard preprocessors with possible extra C sources: c2hs, hsc2hs.
-knownExtrasHandlers :: [ PreProcessorExtras ]
-knownExtrasHandlers = [ ppC2hsExtras, ppHsc2hsExtras ]
+knownExtrasHandlers :: [ WrappedPreProcessorExtras ]
+knownExtrasHandlers = [ WrapPPE ppC2hsExtras, WrapPPE ppHsc2hsExtras ]
-- | Find any extra C sources generated by preprocessing that need to
-- be added to the component (addresses issue #238).
@@ -732,7 +738,7 @@
pp :: FilePath -> IO [FilePath]
pp dir = (map (dir </>) . filter not_sub . concat)
<$> for knownExtrasHandlers
- (withLexicalCallStack (\f -> f dir))
+ (withLexicalCallStack (\f -> f dir) . unWrapPPE)
-- TODO: This is a terrible hack to work around #3545 while we don't
-- reorganize the directory layout. Basically, for the main
-- library, we might accidentally pick up autogenerated sources for
diff -ru yesod-core-1.6.16.orig/src/Yesod/Routes/TH/RenderRoute.hs yesod-core-1.6.16/src/Yesod/Routes/TH/RenderRoute.hs
--- yesod-core-1.6.16.orig/src/Yesod/Routes/TH/RenderRoute.hs 2019-07-18 07:55:12.000000000 -0400
+++ yesod-core-1.6.16/src/Yesod/Routes/TH/RenderRoute.hs 2019-09-01 09:50:29.375154816 -0400
diff -ru yesod-core-1.6.16.1.orig/src/Yesod/Routes/TH/RenderRoute.hs yesod-core-1.6.16.1/src/Yesod/Routes/TH/RenderRoute.hs
--- yesod-core-1.6.16.1.orig/src/Yesod/Routes/TH/RenderRoute.hs 2019-09-08 01:58:30.000000000 -0400
+++ yesod-core-1.6.16.1/src/Yesod/Routes/TH/RenderRoute.hs 2019-09-08 08:45:05.245293347 -0400
@@ -84,7 +84,13 @@
let cons y ys = InfixE (Just y) colon (Just ys)
let pieces' = foldr cons (VarE a) piecesSingle
......@@ -40,15 +40,3 @@ diff -ru yesod-core-1.6.16.orig/src/Yesod/Routes/TH/RenderRoute.hs yesod-core-1.
return $ Clause [pat] (NormalB body) []
@@ -142,7 +158,11 @@
cls <- mkRenderRouteClauses ress
(cons, decs) <- mkRouteCons ress
#if MIN_VERSION_template_haskell(2,12,0)
+# if MIN_VERSION_template_haskell(2,15,0)
+ did <- DataInstD [] Nothing (ConT ''Route `AppT` typ) Nothing cons <$> fmap (pure . DerivClause Nothing) (mapM conT (clazzes False))
+# else
did <- DataInstD [] ''Route [typ] Nothing cons <$> fmap (pure . DerivClause Nothing) (mapM conT (clazzes False))
+# endif
let sds = fmap (\t -> StandaloneDerivD Nothing cxt $ ConT t `AppT` ( ConT ''Route `AppT` typ)) (clazzes True)
#else
did <- DataInstD [] ''Route [typ] Nothing cons <$> mapM conT (clazzes False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment