Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-happy-lib for openSUSE:Factory checked in at 2026-11-24 12:29:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-happy-lib (Old) and /work/SRC/openSUSE:Factory/.ghc-happy-lib.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-happy-lib" Tue Nov 24 12:29:30 2026 rev:3 rq:1399184 version:2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-happy-lib/ghc-happy-lib.changes 2025-08-25 20:38:43.653673150 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-happy-lib.new.1340718/ghc-happy-lib.changes 2026-11-24 12:35:23.330218032 +0100 @@ -1,0 +2,12 @@ +Thu Jan 15 14:19:20 UTC 2026 - Peter Simons <[email protected]> + +- Update happy-lib to version 2.2. + ## 2.2 + + * Error out when `<$>` appears in semantic action code + ([#335](https://github.com/haskell/happy/issues/335)). + + * Tested with GHC 8.0 - 9.14.1. + The Haskell code generated by Happy is for GHC 8.0 and up. + +------------------------------------------------------------------- Old: ---- happy-lib-2.1.7.tar.gz New: ---- happy-lib-2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-happy-lib.spec ++++++ --- /var/tmp/diff_new_pack.Wnzx4H/_old 2026-11-24 12:35:26.084334747 +0100 +++ /var/tmp/diff_new_pack.Wnzx4H/_new 2026-11-24 12:35:26.091335044 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-happy-lib # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,28 +17,32 @@ %global pkg_name happy-lib -%global pkgver %{pkg_name}-%{version} -Name: ghc-%{pkg_name} -Version: 2.1.7 +%bcond_with ghc_prof +Name: ghc-%pkg_name +Version: 2.2 Release: 0 +%global pkgver %pkg_name-%{version} Summary: Happy is a parser generator for Haskell implemented using this library License: BSD-2-Clause -URL: https://hackage.haskell.org/package/%{pkg_name} -Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz +URL: https://hackage.haskell.org/package/%pkg_name +Source0: https://hackage.haskell.org/package/%pkg_name-%{version}/%pkg_name-%{version}.tar.gz BuildRequires: fdupes BuildRequires: ghc-Cabal-devel BuildRequires: ghc-array-devel -BuildRequires: ghc-array-prof BuildRequires: ghc-base-devel -BuildRequires: ghc-base-prof BuildRequires: ghc-containers-devel -BuildRequires: ghc-containers-prof BuildRequires: ghc-mtl-devel -BuildRequires: ghc-mtl-prof -BuildRequires: ghc-rpm-macros +BuildRequires: ghc-rpm-macros >= 2.9.2 BuildRequires: ghc-transformers-devel -BuildRequires: ghc-transformers-prof +Requires: happy-data = %{version} ExcludeArch: %{ix86} +%if %{with ghc_prof} +BuildRequires: ghc-array-prof +BuildRequires: ghc-base-prof +BuildRequires: ghc-containers-prof +BuildRequires: ghc-mtl-prof +BuildRequires: ghc-transformers-prof +%endif %description Happy is a parser generator for Haskell. Given a grammar specification in BNF, @@ -72,31 +76,36 @@ %description devel This package provides the Haskell %{pkg_name} library development files. -%package -n ghc-%{pkg_name}-doc +%package -n ghc-%pkg_name-doc Summary: Haskell %{pkg_name} library documentation Requires: ghc-filesystem BuildArch: noarch -%description -n ghc-%{pkg_name}-doc +%description -n ghc-%pkg_name-doc This package provides the Haskell %{pkg_name} library documentation. -%package templates -Summary: Shared datafiles needed at run-time by both ghc-happy-lib and happy +%package -n happy-data +Summary: Code templates used by the Happy parser generator BuildArch: noarch -%description templates -Shared datafiles that are required by both ghc-happy-lib and happy at run-time. +%description -n happy-data +This package provides the code templates that the Happy parser generator +copies into the parsers it generates. They are needed by the happy executable +and by programs that use the %{pkg_name} library. -%package -n ghc-%{pkg_name}-prof +%if %{with ghc_prof} +%package -n ghc-%pkg_name-prof Summary: Haskell %{pkg_name} profiling library -Requires: ghc-%{pkg_name}-devel = %{version}-%{release} -Supplements: (ghc-%{pkg_name}-devel and ghc-prof) +Requires: ghc-%pkg_name-devel = %{version}-%{release} +Supplements: (ghc-%pkg_name-devel and ghc-prof) -%description -n ghc-%{pkg_name}-prof +%description -n ghc-%pkg_name-prof This package provides the Haskell %{pkg_name} profiling library. +%endif + %prep -%autosetup -n %{pkg_name}-%{version} +%autosetup -p1 -n %pkg_name-%{version} %build %ghc_lib_build @@ -113,16 +122,18 @@ %files -f %{name}.files -%files templates -%dir %{_datadir}/%{pkg_name}-%{version} -%{_datadir}/%{pkg_name}-%{version}/GLR_Base.hs -%{_datadir}/%{pkg_name}-%{version}/GLR_Lib.hs -%{_datadir}/%{pkg_name}-%{version}/HappyTemplate.hs +%files -n happy-data +%dir %{_datadir}/%pkg_name-%{version} +%{_datadir}/%pkg_name-%{version}/GLR_Base.hs +%{_datadir}/%pkg_name-%{version}/GLR_Lib.hs +%{_datadir}/%pkg_name-%{version}/HappyTemplate.hs %files devel -f %{name}-devel.files %doc ChangeLog.md README.md -%files -n ghc-%{pkg_name}-doc -f ghc-%{pkg_name}-doc.files +%files -n ghc-%pkg_name-doc -f ghc-%pkg_name-doc.files -%files -n ghc-%{pkg_name}-prof -f ghc-%{pkg_name}-prof.files +%if %{with ghc_prof} +%files -n ghc-%pkg_name-prof -f ghc-%pkg_name-prof.files +%endif ++++++ happy-lib-2.1.7.tar.gz -> happy-lib-2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/happy-lib-2.1.7/ChangeLog.md new/happy-lib-2.2/ChangeLog.md --- old/happy-lib-2.1.7/ChangeLog.md 2001-09-09 03:46:40.000000000 +0200 +++ new/happy-lib-2.2/ChangeLog.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,13 @@ # Revision history for Happy +## 2.2 + +* Error out when `<$>` appears in semantic action code + ([#335](https://github.com/haskell/happy/issues/335)). + +* Tested with GHC 8.0 - 9.14.1. + The Haskell code generated by Happy is for GHC 8.0 and up. + ## 2.1.7 * Add support for `{-# OPTIONS_HAPPY ... #-}` pragmas diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/happy-lib-2.1.7/frontend/src/Happy/Frontend/Mangler.lhs new/happy-lib-2.2/frontend/src/Happy/Frontend/Mangler.lhs --- old/happy-lib-2.1.7/frontend/src/Happy/Frontend/Mangler.lhs 2001-09-09 03:46:40.000000000 +0200 +++ new/happy-lib-2.2/frontend/src/Happy/Frontend/Mangler.lhs 2001-09-09 03:46:40.000000000 +0200 @@ -87,7 +87,7 @@ > ns -> ns > error_resumptive | ResumptiveErrorHandler{} <- getError dirs = True > | otherwise = False -> + > start_strs = [ startName++'_':p | (TokenName p _ _) <- starts' ] Build up a mapping from name values to strings. @@ -132,7 +132,7 @@ Deal with priorities... > priodir = zip [1..] (getPrios dirs) -> + > mkPrio :: Int -> Directive a -> Priority > mkPrio i (TokenNonassoc _) = Prio None i > mkPrio i (TokenRight _) = Prio RightAssoc i @@ -155,10 +155,10 @@ > convNT (Rule1 nt prods ty) > = do nt' <- mapToName nt > return (nt', prods, ty) -> + > transRule (nt, prods, _ty) > = mapM (finishRule nt) prods -> + > finishRule :: Name -> Prod1 e -> Writer [ErrMsg] (Production e) > finishRule nt (Prod1 lhs code line prec) > = mapWriter (\(a,e) -> (a, map (addLine line) e)) $ do @@ -168,7 +168,7 @@ > Left s -> do addErr ("Undeclared precedence token: " ++ s) > return (Production nt lhs' code' No) > Right p -> return (Production nt lhs' code' p) -> + > mkPrec :: [Name] -> Prec -> Either String Priority > mkPrec lhs PrecNone = > case filter (flip elem terminal_names) lhs of @@ -180,9 +180,9 @@ > case lookup s prioByString of > Nothing -> Left s > Just p -> Right p -> + > mkPrec _ PrecShift = Right PrioLowest -> + > -- in > rules1 <- mapM convNT rules @@ -191,7 +191,7 @@ > let > type_env = [(nt, t) | Rule1 nt _ (Just (t,[])) <- rules] ++ > [(nt, getTokenType dirs) | nt <- terminal_strs] -- XXX: > Doesn't handle $$ type! -> + > fixType (ty,s) = go "" ty > where go acc [] = return (reverse acc) > go acc (c:r) | isLower c = -- look for a run of alphanumerics > starting with a lower case letter @@ -205,14 +205,14 @@ > go1 (c:cs) > Just t -> go1 $ "(" ++ t ++ ")" > | otherwise = go (c:acc) r -> + > convType (nm, t) > = do t' <- fixType t > return (nm, t') -> + > -- in > tys <- mapM convType [ (nm, t) | (nm, _, Just t) <- rules1 ] -> + > let > type_array :: Array Name (Maybe String) @@ -238,7 +238,7 @@ > lookup_prods :: Name -> [Int] > lookup_prods x | x >= firstStartTok && x < first_t = arr ! x > lookup_prods _ = error "lookup_prods" -> + > productions' = start_prods ++ concat rules2 > prod_array = listArray (0,length productions' - 1) productions' @@ -278,7 +278,7 @@ > combine [] = [] > combine ((a,b):(c,d):r) | a == c = combine ((a,b++d) : r) > combine (a:r) = a : combine r -> + For combining actions with possible error messages. @@ -307,12 +307,15 @@ -- At the same time, we collect a list of the variables actually used in this -- code, which is used by the backend. -> doCheckCode :: Int -> String -> M (String, [Int]) +> doCheckCode :: +> Int -- ^ Arity of the rule, i.e., maximal number of a variable. +> -> String -- ^ Haskell code for the semantic action of the rule. +> -> M (String, [Int]) -- ^ The translated code and the variable occurrences (in reverse order). > doCheckCode arity code0 = go code0 "" [] > where go code acc used = > case code of > [] -> return (reverse acc, used) -> + > '"' :r -> case reads code :: [(String,String)] of > [] -> go r ('"':acc) used > (s,r'):_ -> go r' (reverse (show s) ++ acc) > used @@ -321,13 +324,24 @@ > [] -> go r ('\'':acc) used > (c,r'):_ -> go r' (reverse (show c) ++ acc) > used > '\\':'$':r -> go r ('$':acc) used -> + + +Issue #335 (Andreas Abel, 2026-01-14): +Users often write '<$>' to mean '`fmap`', but Happy interprets it as '< $>' where '$>' +denotes the maximal variable (rightmost item). +Thus, reject '<$>' in semantic action code and suggest to either escape the '$' +or put a space after '<'. + +> c@'<':r@('$':'>':_) -> do +> addErr "Found '<$>' in semantic action code; either write '<\\$>' (for what usually is fmap) or '< $>' (for \"less than rightmost item\")" +> go r (c:acc) used + > '$':'>':r -- the "rightmost token" > | arity == 0 -> do addErr "$> in empty rule" > go r acc used > | otherwise -> go r (reverse (mkHappyVar arity) ++ > acc) > (arity : used) -> + > '$':r@(i:_) | isDigit i -> > case reads r :: [(Int,String)] of > (j,r'):_ -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/happy-lib-2.1.7/happy-lib.cabal new/happy-lib-2.2/happy-lib.cabal --- old/happy-lib-2.1.7/happy-lib.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/happy-lib-2.2/happy-lib.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ cabal-version: 3.0 name: happy-lib -version: 2.1.7 +version: 2.2 license: BSD-2-Clause copyright: (c) Andy Gill, Simon Marlow author: Andy Gill and Simon Marlow @@ -34,8 +34,9 @@ multiple parse trees (Happy.Backend.GLR.*) tested-with: + GHC == 9.14.1 GHC == 9.12.2 - GHC == 9.10.2 + GHC == 9.10.3 GHC == 9.8.4 GHC == 9.6.7 GHC == 9.4.8
