packages feed

PyF 0.11.4.0 → 0.11.5.0

raw patch · 5 files changed

+49/−10 lines, 5 filesdep ~basedep ~template-haskelldep ~timePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, template-haskell, time

API changes (from Hackage documentation)

- PyF.Class: pyfFormatFractional :: (PyfFormatFractional a, Integral paddingWidth, Integral precision) => Format t t' 'Fractional -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> Maybe precision -> a -> String
+ PyF.Class: pyfFormatFractional :: forall paddingWidth precision (t :: AltStatus) (t' :: UpperStatus) (k :: AlignForString). (PyfFormatFractional a, Integral paddingWidth, Integral precision) => Format t t' 'Fractional -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> Maybe precision -> a -> String
- PyF.Class: pyfFormatIntegral :: (PyfFormatIntegral i, Integral paddingWidth) => Format t t' 'Integral -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> i -> String
+ PyF.Class: pyfFormatIntegral :: forall paddingWidth (t :: AltStatus) (t' :: UpperStatus) (k :: AlignForString). (PyfFormatIntegral i, Integral paddingWidth) => Format t t' 'Integral -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> i -> String
- PyF.Formatters: [Alternate] :: Format 'CanAlt u f -> Format 'NoAlt u f
+ PyF.Formatters: [Alternate] :: forall (k' :: UpperStatus) (k'' :: FormatType). Format 'CanAlt k' k'' -> Format 'NoAlt k' k''
- PyF.Formatters: [AnyAlign] :: AlignMode (k :: AlignForString) -> AnyAlign
+ PyF.Formatters: [AnyAlign] :: forall (k :: AlignForString). AlignMode k -> AnyAlign
- PyF.Formatters: [Upper] :: Format alt 'CanUpper f -> Format 'NoAlt 'NoUpper f
+ PyF.Formatters: [Upper] :: forall (alt :: AltStatus) (k'' :: FormatType). Format alt 'CanUpper k'' -> Format 'NoAlt 'NoUpper k''
- PyF.Formatters: formatFractional :: (RealFloat f, Integral paddingWidth, Integral precision) => Format t t' 'Fractional -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> Maybe precision -> f -> String
+ PyF.Formatters: formatFractional :: forall f paddingWidth precision (t :: AltStatus) (t' :: UpperStatus) (k :: AlignForString). (RealFloat f, Integral paddingWidth, Integral precision) => Format t t' 'Fractional -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> Maybe precision -> f -> String
- PyF.Formatters: formatIntegral :: Integral paddingWidth => Integral i => Format t t' 'Integral -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> i -> String
+ PyF.Formatters: formatIntegral :: forall paddingWidth i (t :: AltStatus) (t' :: UpperStatus) (k :: AlignForString). (Integral paddingWidth, Integral i) => Format t t' 'Integral -> SignMode -> Maybe (paddingWidth, AlignMode k, Char) -> Maybe (Int, Char) -> i -> String
- PyF.Formatters: formatString :: forall paddingWidth precision. (Integral paddingWidth, Integral precision) => Maybe (paddingWidth, AlignMode 'AlignAll, Char) -> Maybe precision -> String -> String
+ PyF.Formatters: formatString :: (Integral paddingWidth, Integral precision) => Maybe (paddingWidth, AlignMode 'AlignAll, Char) -> Maybe precision -> String -> String
- PyF.Formatters: getAlignForString :: AlignMode k -> Maybe (AlignMode 'AlignAll)
+ PyF.Formatters: getAlignForString :: forall (k :: AlignForString). AlignMode k -> Maybe (AlignMode 'AlignAll)
- PyF.Internal.PythonSyntax: type Parser t = ParsecT String () (Reader ParsingContext) t
+ PyF.Internal.PythonSyntax: type Parser t = ParsecT String () Reader ParsingContext t

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for PyF +## 0.11.5.0 -- 2025-12-01++- Release with support for GHC 9.14 (tested with -rc1)+ ## 0.11.4.0 -- 2025-01-03  - Fix indentation in `fmtTrim` when line break was escaped (bug https://github.com/guibou/PyF/issues/141).
PyF.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               PyF-version:            0.11.4.0+version:            0.11.5.0 synopsis:   Quasiquotations for a python like interpolated string formatter @@ -31,14 +31,14 @@     PyF.Internal.QQ    build-depends:-    , base              >=4.12   && <4.22+    , base              >=4.12   && <4.23     , bytestring        >=0.10.8 && <0.13     , ghc               >=8.6.1     , mtl               >=2.2.2  && <2.4     , parsec            >=3.1.13 && <3.2-    , template-haskell  >=2.14.0 && <2.24+    , template-haskell  >=2.14.0 && <2.25     , text              >=1.2.3  && <2.2-    , time              >=1.8.0  && <1.15+    , time              >=1.8.0  && <1.16    if impl(ghc <9.2.1)     build-depends: ghc-boot >=8.6.1 && <9.7
src/PyF/Internal/Meta.hs view
@@ -6,6 +6,8 @@  module PyF.Internal.Meta (toExp, baseDynFlags, toName) where +import qualified Data.List.NonEmpty as NE+ #if MIN_VERSION_ghc(9,2,0) import GHC.Hs.Type (HsWildCardBndrs (..), HsType (..), HsSigType(HsSig), sig_body) #elif MIN_VERSION_ghc(9,0,0)@@ -95,8 +97,13 @@ toLit (HsWordPrim _ i) = TH.WordPrimL i toLit (HsInt64Prim _ i) = TH.IntegerL i toLit (HsWord64Prim _ i) = TH.WordPrimL i-toLit (HsInteger _ i _) = TH.IntegerL i+#if MIN_VERSION_ghc(9,13,0)+-- toLit (HsRat _ f _) = TH.FloatPrimL (fl_value f)+-- toLit (HsInteger _ i _) = TH.IntegerL i+#else toLit (HsRat _ f _) = TH.FloatPrimL (fl_value f)+toLit (HsInteger _ i _) = TH.IntegerL i+#endif toLit (HsFloatPrim _ f) = TH.FloatPrimL (fl_value f) toLit (HsDoublePrim _ f) = TH.DoublePrimL (fl_value f) #if MIN_VERSION_ghc(9,7,0)@@ -150,13 +157,16 @@    in if isRdrDataCon n'         then TH.ConE (toName n')         else TH.VarE (toName n')-#if MIN_VERSION_ghc(9,6,0)+#if MIN_VERSION_ghc(9, 13, 0)++#elif MIN_VERSION_ghc(9,6,0) toExp _ (Expr.HsUnboundVar _ n)              = TH.UnboundVarE (TH.mkName . occNameString . rdrNameOcc $ n) #elif MIN_VERSION_ghc(9,0,0) toExp _ (Expr.HsUnboundVar _ n)              = TH.UnboundVarE (TH.mkName . occNameString $ n) #else toExp _ (Expr.HsUnboundVar _ n)              = TH.UnboundVarE (TH.mkName . occNameString . Expr.unboundVarOcc $ n) #endif+ toExp _ Expr.HsIPVar {} = noTH "toExp" "HsIPVar" toExp _ (Expr.HsLit _ l) = TH.LitE (toLit l) toExp _ (Expr.HsOverLit _ OverLit {ol_val}) = TH.LitE (toLit' ol_val)@@ -179,8 +189,10 @@ #endif toExp d (Expr.OpApp _ e1 o e2) = TH.UInfixE (toExp d . unLoc $ e1) (toExp d . unLoc $ o) (toExp d . unLoc $ e2) toExp d (Expr.NegApp _ e _) = TH.AppE (TH.VarE 'negate) (toExp d . unLoc $ e)+#if MIN_VERSION_ghc(9,13,0)+toExp d (Expr.HsLam _ _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (unLoc -> map unLoc -> ps) (Expr.GRHSs _ (NE.toList -> [unLoc -> Expr.GRHS _ _ (unLoc -> e)]) _)])))) = TH.LamE (fmap (toPat d) ps) (toExp d e)+#elif MIN_VERSION_ghc(9,12,0) -- NOTE: for lambda, there is only one match-#if MIN_VERSION_ghc(9,12,0) toExp d (Expr.HsLam _ _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (unLoc -> map unLoc -> ps) (Expr.GRHSs _ [unLoc -> Expr.GRHS _ _ (unLoc -> e)] _)])))) = TH.LamE (fmap (toPat d) ps) (toExp d e) #elif MIN_VERSION_ghc(9,10,0) toExp d (Expr.HsLam _ _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (Expr.GRHSs _ [unLoc -> Expr.GRHS _ _ (unLoc -> e)] _)])))) = TH.LamE (fmap (toPat d) ps) (toExp d e)
src/PyF/Internal/ParserEx.hs view
@@ -96,16 +96,28 @@ import GHC.Driver.Config.Parser (initParserOpts) #endif +#if MIN_VERSION_ghc(9,13,0)+import GHC.Unit.Types (UnitId(..))+#endif+ import Data.Maybe  fakeSettings :: Settings fakeSettings = Settings-#if MIN_VERSION_ghc(9, 2, 0)+#if MIN_VERSION_ghc(9, 13, 0)   { sGhcNameVersion=ghcNameVersion   , sFileSettings=fileSettings   , sTargetPlatform=platform+  , sToolSettings=toolSettings   , sPlatformMisc=platformMisc+  , sUnitSettings = UnitSettings (UnitId $ fsLit "pyf-preprocessor")+  }+#elif MIN_VERSION_ghc(9, 2, 0)+  { sGhcNameVersion=ghcNameVersion+  , sFileSettings=fileSettings+  , sTargetPlatform=platform   , sToolSettings=toolSettings+  , sPlatformMisc=platformMisc   } #elif MIN_VERSION_ghc(8, 10, 0)   { sGhcNameVersion=ghcNameVersion
src/PyF/Internal/QQ.hs view
@@ -27,6 +27,8 @@   ) where +import qualified Data.List.NonEmpty as NE+ import Control.Monad.Reader import Data.Data (Data (gmapQ), Typeable, cast) import Data.Kind@@ -196,7 +198,13 @@       Just (HsVar _ l) -> [l] #endif -#if MIN_VERSION_ghc(9,12,0)+#if MIN_VERSION_ghc(9,13,0)+      Just (HsLam _ _ (MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (unLoc -> map unLoc -> ps) (GRHSs _ (NE.toList -> [unLoc -> GRHS _ _ (unLoc -> e)]) _)])))) -> filter keepVar subVars+        where+          keepVar (L _ n) = n `notElem` subPats+          subVars = concat $ gmapQ f [e]+          subPats = concat $ gmapQ findPats ps+#elif MIN_VERSION_ghc(9,12,0)       Just (HsLam _ _ (MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (unLoc -> map unLoc -> ps) (GRHSs _ [unLoc -> GRHS _ _ (unLoc -> e)] _)])))) -> filter keepVar subVars         where           keepVar (L _ n) = n `notElem` subPats@@ -273,7 +281,10 @@ reportErrorAt :: SrcSpan -> String -> Q () reportErrorAt loc msg = unsafeRunTcM $ addErrAt loc msg'   where-#if MIN_VERSION_ghc(9,7,0)+#if MIN_VERSION_ghc(9,13,0)+    -- TODO: maybe leverage the "hint" logic to add additionnal hints here?+    msg' = TcRnUnknownMessage (UnknownDiagnostic (const NoDiagnosticOpts) (\x -> x) (mkPlainError noHints (text msg)))+#elif MIN_VERSION_ghc(9,7,0)     msg' = TcRnUnknownMessage (UnknownDiagnostic (const NoDiagnosticOpts) (mkPlainError noHints (text msg))) #elif MIN_VERSION_ghc(9,6,0)     msg' = TcRnUnknownMessage (UnknownDiagnostic $ mkPlainError noHints $