From b59fe24c118826e91709170c97913a8db79374af Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 17 Nov 2023 14:11:59 +0100 Subject: [PATCH 01/35] use older python version to keep distutils --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 5e484bdd0..997ee7bd0 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -59,7 +59,7 @@ jobs: - uses: actions/setup-python@v2 name: Install Python with: - python-version: '3.x' + python-version: '3.10' - name: Build sdist run: cd src/runtime/python && python setup.py sdist From c2182274df0a0f730b4d4a41ea4a537cdb388ecd Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 14 Dec 2023 11:56:11 +0100 Subject: [PATCH 02/35] visualize_dependencies (vd) now creates latex in landscape mode to show long trees better --- src/runtime/haskell/PGF/VisualizeTree.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/haskell/PGF/VisualizeTree.hs b/src/runtime/haskell/PGF/VisualizeTree.hs index 32709bac0..4142332ac 100644 --- a/src/runtime/haskell/PGF/VisualizeTree.hs +++ b/src/runtime/haskell/PGF/VisualizeTree.hs @@ -651,6 +651,7 @@ app macro arg = text "\\" <> text macro <> text "{" <> arg <> text "}" latexDoc :: Doc -> Doc latexDoc body = vcat [text "\\documentclass{article}", + text "\\usepackage[a4paper,margin=0.5in,landscape]{geometry}", text "\\usepackage[utf8]{inputenc}", text "\\begin{document}", body, From 7e707508a72ce73d6c3e4b8881df37597f5b8801 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 1 Mar 2024 09:17:08 +0100 Subject: [PATCH 03/35] showExpr and linearize now refresh the printed variables if needed --- src/runtime/haskell/PGF/Expr.hs | 17 ++++++++++++++--- src/runtime/haskell/PGF/Linearize.hs | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs index d015f18e0..ff1114235 100644 --- a/src/runtime/haskell/PGF/Expr.hs +++ b/src/runtime/haskell/PGF/Expr.hs @@ -17,7 +17,8 @@ module PGF.Expr(Tree, BindType(..), Expr(..), Literal(..), Patt(..), Equation(.. MetaId, -- helpers - pMeta,pArg,pLit,freshName,ppMeta,ppLit,ppParens + pMeta,pArg,pLit,freshName,ppMeta,ppLit,ppParens, + freshBoundVars ) where import PGF.CId @@ -235,10 +236,11 @@ pLit = liftM LStr (RP.readS_to_P reads) ppExpr :: Int -> [CId] -> Expr -> PP.Doc ppExpr d scope (EAbs b x e) = let (bs,xs,e1) = getVars [] [] (EAbs b x e) + xs' = freshBoundVars scope xs in ppParens (d > 1) (PP.char '\\' PP.<> - PP.hsep (PP.punctuate PP.comma (reverse (List.zipWith ppBind bs xs))) PP.<+> + PP.hsep (PP.punctuate PP.comma (reverse (List.zipWith ppBind bs xs'))) PP.<+> PP.text "->" PP.<+> - ppExpr 1 (xs++scope) e1) + ppExpr 1 (xs' ++ scope) e1) where getVars bs xs (EAbs b x e) = getVars (b:bs) ((freshName x xs):xs) e getVars bs xs e = (bs,xs,e) @@ -289,6 +291,15 @@ freshName x xs0 = loop 1 x | elem y xs = loop (i+1) (mkCId (show x++show i)) | otherwise = y +-- refresh new vars xs in scope if needed. AR 2024-03-01 +freshBoundVars :: [CId] -> [CId] -> [CId] +freshBoundVars scope xs = foldr fresh [] xs + where + fresh x xs' = mkCId (freshName (showCId x) xs') : xs' + freshName s xs' = + if elem (mkCId s) (xs' ++ scope) + then freshName (s ++ "'") xs' + else s ----------------------------------------------------- -- Computation diff --git a/src/runtime/haskell/PGF/Linearize.hs b/src/runtime/haskell/PGF/Linearize.hs index 5fdb186c1..a508f3dbc 100644 --- a/src/runtime/haskell/PGF/Linearize.hs +++ b/src/runtime/haskell/PGF/Linearize.hs @@ -81,7 +81,7 @@ linTree pgf cnc e = nub (map snd (lin Nothing 0 e [] [] e [])) where lp = lproductions cnc - lin mb_cty n_fid e0 ys xs (EAbs _ x e) es = lin mb_cty n_fid e0 ys (x:xs) e es + lin mb_cty n_fid e0 ys xs (EAbs _ x e) es = lin mb_cty n_fid e0 ys (freshBoundVars (xs ++ ys) [x] ++ xs) e es --fresh: AR 2024 lin mb_cty n_fid e0 ys xs (EApp e1 e2) es = lin mb_cty n_fid e0 ys xs e1 (e2:es) lin mb_cty n_fid e0 ys xs (EImplArg e) es = lin mb_cty n_fid e0 ys xs e es lin mb_cty n_fid e0 ys xs (ETyped e _) es = lin mb_cty n_fid e0 ys xs e es From 2f31bbab23a2bea8b32fcb3d370928ddb72a9735 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 15 Mar 2024 12:43:17 +0100 Subject: [PATCH 04/35] Apply gt to all arguments when piped --- src/compiler/GF/Command/Commands.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index a6c66594f..f31a23083 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -218,9 +218,9 @@ pgfCommands = Map.fromList [ exec = getEnv $ \ opts arg (Env pgf mos) -> do let pgfr = optRestricted opts pgf let dp = valIntOpts "depth" 4 opts - let ts = case mexp (toExprs arg) of - Just ex -> generateFromDepth pgfr ex (Just dp) - Nothing -> generateAllDepth pgfr (optType pgf opts) (Just dp) + let ts = case toExprs arg of + [] -> generateAllDepth pgfr (optType pgf opts) (Just dp) + es -> concat [generateFromDepth pgfr e (Just dp) | e <- es] returnFromExprs $ take (optNumInf opts) ts }), ("i", emptyCommandInfo { From b855a094f8e09c4dc405015d74187020991a3ae7 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 29 Apr 2024 20:42:51 +0800 Subject: [PATCH 05/35] Clarify description for vt --- doc/tutorial/gf-tutorial.t2t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index 2c8d909de..c43382ea0 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1265,10 +1265,16 @@ Human eye may prefer to see a visualization: ``visualize_tree = vt``: > parse "this delicious cheese is very Italian" | visualize_tree ``` The tree is generated in postscript (``.ps``) file. The ``-view`` option is used for -telling what command to use to view the file. Its default is ``"open"``, which works -on Mac OS X. On Ubuntu Linux, one can write +telling what command to use to view the file. + +This works on Mac OS X: +``` + > parse "this delicious cheese is very Italian" | visualize_tree -view=open +``` +On Linux, one can write either of ``` > parse "this delicious cheese is very Italian" | visualize_tree -view="eog" + > parse "this delicious cheese is very Italian" | visualize_tree -view=xdg-open ``` From 2a654c085f16435a2efa33c0caa4b92143a920fa Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 29 Apr 2024 20:44:53 +0800 Subject: [PATCH 06/35] be consistent in the use of quotes --- doc/tutorial/gf-tutorial.t2t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index c43382ea0..a734a57b6 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1271,9 +1271,9 @@ This works on Mac OS X: ``` > parse "this delicious cheese is very Italian" | visualize_tree -view=open ``` -On Linux, one can write either of +On Linux, one can use one of the following commands. ``` - > parse "this delicious cheese is very Italian" | visualize_tree -view="eog" + > parse "this delicious cheese is very Italian" | visualize_tree -view=eog > parse "this delicious cheese is very Italian" | visualize_tree -view=xdg-open ``` From c65dc70aaf413a1db9f857cde9a3ef58f851211c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:17:51 +0000 Subject: [PATCH 07/35] Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 997ee7bd0..97f13c6fc 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -85,7 +85,7 @@ jobs: - name: Install twine run: pip install twine - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4.1.7 with: name: artifact path: ./dist From ed0a8ca0df669ae9713fe189e580c1f18b3dacea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:34:01 +0200 Subject: [PATCH 08/35] Update setup-python github action Let's see if this fixes CI --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 97f13c6fc..30995372c 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5.20 name: Install Python with: python-version: '3.x' From eaec428a89cb5313991a5fa37a76a476a1e85651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:35:39 +0200 Subject: [PATCH 09/35] fix typo --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 30995372c..6076946eb 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-python@v5.20 + - uses: actions/setup-python@v5.2.0 name: Install Python with: python-version: '3.x' From fc614cd48ee60ceeda212a7f47f18e1cb69c72e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:40:29 +0200 Subject: [PATCH 10/35] Bump more action versions --- .github/workflows/build-python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 6076946eb..c18709c69 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -46,7 +46,7 @@ jobs: run: | python -m cibuildwheel src/runtime/python --output-dir wheelhouse - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse @@ -78,7 +78,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5.2.0 with: python-version: '3.x' From 5eab0a626d5a047b53874eb9adbfb09dff812b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:47:14 +0200 Subject: [PATCH 11/35] add glibtoolize dependency for mac CI --- .github/workflows/build-python-package.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index c18709c69..bbc4d1dcc 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-python@v5.2.0 + - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.x' @@ -31,6 +31,7 @@ jobs: if: startsWith(matrix.os, 'macos') run: | brew install automake + brew install libtool - name: Build wheels on Linux if: startsWith(matrix.os, 'macos') != true @@ -64,7 +65,7 @@ jobs: - name: Build sdist run: cd src/runtime/python && python setup.py sdist - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: path: ./src/runtime/python/dist/*.tar.gz @@ -78,7 +79,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5 with: python-version: '3.x' From 9492967fc6b48b55c9fbc1b4e9a20c5d61daba4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 16:08:09 +0200 Subject: [PATCH 12/35] add sudo to make install to fix CI failure --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index bbc4d1dcc..8260fbd98 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -43,7 +43,7 @@ jobs: - name: Build wheels on OSX if: startsWith(matrix.os, 'macos') env: - CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && make install + CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && sudo make install run: | python -m cibuildwheel src/runtime/python --output-dir wheelhouse From 33b0bab6106a3bbfc02fb3bcb225bc2e67d1e0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 16:22:59 +0200 Subject: [PATCH 13/35] Use different artifact names as is required by upload-artifact@v4 --- .github/workflows/build-python-package.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 8260fbd98..d7d8ac94a 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -49,6 +49,7 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: wheel-${{ matrix.os }} path: ./wheelhouse build_sdist: @@ -67,6 +68,7 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: wheel-source path: ./src/runtime/python/dist/*.tar.gz upload_pypi: @@ -88,7 +90,8 @@ jobs: - uses: actions/download-artifact@v4.1.7 with: - name: artifact + pattern: wheel-* + merge-multiple: true path: ./dist - name: Publish From aa061aff0ce24c19ea36104744a586add27e3e71 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 26 Nov 2024 12:15:41 +0100 Subject: [PATCH 14/35] Update robots.txt --- src/www/robots.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/www/robots.txt b/src/www/robots.txt index 5b3ee3354..d559fc731 100644 --- a/src/www/robots.txt +++ b/src/www/robots.txt @@ -1,4 +1,5 @@ User-agent: * Disallow: /grammars Disallow: /robust +Disallow: /wikidata Disallow: /*.pgf From bc56b54dd12854c2e805dc597f906f879c46d908 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Tue, 7 Jan 2025 11:20:23 +0100 Subject: [PATCH 15/35] random generation of literals now has ten different values for each built in type; maybe a better solution for most cases than just one value --- src/runtime/haskell/PGF/TypeCheck.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/runtime/haskell/PGF/TypeCheck.hs b/src/runtime/haskell/PGF/TypeCheck.hs index c5cc44b4e..82bd47b7a 100644 --- a/src/runtime/haskell/PGF/TypeCheck.hs +++ b/src/runtime/haskell/PGF/TypeCheck.hs @@ -147,9 +147,9 @@ typeGenerators scope cat = fmap normalize (liftM2 (++) x y) where Scope gamma = scope - y | cat == cidInt = return [(1.0,ELit (LInt 999), TTyp [] (DTyp [] cat []))] - | cat == cidFloat = return [(1.0,ELit (LFlt 3.14), TTyp [] (DTyp [] cat []))] - | cat == cidString = return [(1.0,ELit (LStr "Foo"),TTyp [] (DTyp [] cat []))] + y | cat == cidInt = return [(0.1, ELit (LInt n), TTyp [] (DTyp [] cat [])) | n <- ints] + | cat == cidFloat = return [(0.1, ELit (LFlt d), TTyp [] (DTyp [] cat [])) | d <- floats] + | cat == cidString = return [(0.1, ELit (LStr s),TTyp [] (DTyp [] cat [])) | s <- strs] | otherwise = TcM (\abstr k h ms -> case Map.lookup cat (cats abstr) of Just (_,fns,_) -> unTcM (mapM helper fns) abstr k h ms @@ -163,6 +163,11 @@ typeGenerators scope cat = fmap normalize (liftM2 (++) x y) where s = sum [p | (p,_,_) <- gens] + -- random elements of predefined types: many instead of one AR 2025-01-17 + ints = [1, 2, 3, 14, 42, 123, 999, 2025, 1000000, 1234567890] + floats = [0.0, 1.0, 3.14, 0.999, 0.5772156649, 2.71828, 6.62607015, 19.3, 0.0001, 1.60934] + strs = words "A B X Y b c x y foo bar" + emptyMetaStore :: MetaStore s emptyMetaStore = IntMap.empty From c7226cc11c4505e3946f6d95c7cb56c6cc3ce2fa Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 18 Jan 2025 07:13:24 +0100 Subject: [PATCH 16/35] add GFSS2025 + remove IRC channel --- index.html | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index dd252ec94..214d8c66f 100644 --- a/index.html +++ b/index.html @@ -87,11 +87,6 @@

Contribute

  • - - - IRC - - / Discord @@ -232,14 +227,10 @@ least one, it may help you to get a first idea of what GF is.

    - We run the IRC channel #gf on the Libera network, where you are welcome to look for help with small questions or just start a general discussion. - You can open a web chat - or browse the channel logs. -

    -

    - There is also a GF server on Discord. + We run the GF server on Discord, where you are welcome to look for help with small questions or just start a general discussion.

    +

    For bug reports and feature requests, please create an issue in the GF Core or @@ -254,6 +245,10 @@ least one, it may help you to get a first idea of what GF is.

    News

    +
    2025-01-18
    +
    + 9th GF Summer School, in Gothenburg, Sweden, 18 – 29 August 2025. +
    2023-01-24
    8th GF Summer School, in Tampere, Finland, 14 – 25 August 2023. From 41f45e572b31abf197b5896645aa856abfb406de Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 18 Jan 2025 07:27:46 +0100 Subject: [PATCH 17/35] Instruction to downgrade LLVM for macOS Sequoia --- download/index-3.11.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/download/index-3.11.md b/download/index-3.11.md index 8fa1d5c02..c557de022 100644 --- a/download/index-3.11.md +++ b/download/index-3.11.md @@ -139,6 +139,8 @@ stack install For more info on working with the GF source code, see the [GF Developers Guide](../doc/gf-developers.html). +For macOS Sequoia, you need to downgrade the LLVM package, see instructions [here](https://github.com/GrammaticalFramework/gf-core/issues/172#issuecomment-2599365457). + ## Installing the Python bindings from PyPI The Python library is available on PyPI as `pgf`, so it can be installed using: From 643617ccc4faafa659aa16fae2870ac68a8f394b Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Tue, 18 Feb 2025 12:41:14 +0100 Subject: [PATCH 18/35] Bug fix for gf-shell command 'pt -compute' in Expr.hs by tryMatch p (VConst _ _) env = match sig f eqs as0 --- src/runtime/haskell/PGF/Expr.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs index ff1114235..42c0df14e 100644 --- a/src/runtime/haskell/PGF/Expr.hs +++ b/src/runtime/haskell/PGF/Expr.hs @@ -408,7 +408,7 @@ match sig f eqs as0 = tryMatch (p ) (VMeta i envi vs ) env = VSusp i envi vs (\v -> tryMatch p v env) tryMatch (p ) (VGen i vs ) env = VConst f as0 tryMatch (p ) (VSusp i envi vs k) env = VSusp i envi vs (\v -> tryMatch p (k v) env) - tryMatch (p ) v@(VConst _ _ ) env = VConst f as0 + tryMatch (p ) v@(VConst _ _ ) env = match sig f eqs as0 tryMatch (PApp f1 ps1) (VApp f2 vs2 ) env | f1 == f2 = tryMatches eqs (ps1++ps) (vs2++as) res env tryMatch (PLit l1 ) (VLit l2 ) env | l1 == l2 = tryMatches eqs ps as res env tryMatch (PImplArg p ) (VImplArg v ) env = tryMatch p v env From 5776b567a2aa78902bf5e4b40cf0bbb69bdbde9a Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Wed, 19 Feb 2025 12:59:43 +0100 Subject: [PATCH 19/35] Reactivate the gf-shell command 'pt -transfer' --- src/compiler/GF/Command/Commands.hs | 3 ++- src/compiler/GF/Command/TreeOperations.hs | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index f31a23083..7f27e8a45 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -428,7 +428,8 @@ pgfCommands = Map.fromList [ "are type checking and semantic computation." ], examples = [ - mkEx "pt -compute (plus one two) -- compute value" + mkEx "pt -compute (plus one two) -- compute value", + mkEx ("p \"the 4 dogs\" | pt -transfer=digits2numeral | l -- \"the four dogs\" ") ], exec = getEnv $ \ opts arg (Env pgf mos) -> returnFromExprs . takeOptNum opts . treeOps pgf opts $ toExprs arg, diff --git a/src/compiler/GF/Command/TreeOperations.hs b/src/compiler/GF/Command/TreeOperations.hs index fc0e6616d..7497eb7e8 100644 --- a/src/compiler/GF/Command/TreeOperations.hs +++ b/src/compiler/GF/Command/TreeOperations.hs @@ -5,6 +5,8 @@ module GF.Command.TreeOperations ( ) where import PGF(Expr,PGF,CId,compute,mkApp,unApp,unapply,unMeta,exprSize,exprFunctions) +import PGF.Data(Expr(EApp,EFun)) +import PGF.TypeCheck(inferExpr) import Data.List type TreeOp = [Expr] -> [Expr] @@ -16,15 +18,17 @@ allTreeOps :: PGF -> [(String,(String,Either TreeOp (CId -> TreeOp)))] allTreeOps pgf = [ ("compute",("compute by using semantic definitions (def)", Left $ map (compute pgf))), + ("transfer",("apply this transfer function to all maximal subtrees of suitable type", + Right $ \f -> map (transfer pgf f))), -- HL 12/24, modified from gf-3.3 ("largest",("sort trees from largest to smallest, in number of nodes", Left $ largest)), - ("nub",("remove duplicate trees", + ("nub\t",("remove duplicate trees", Left $ nub)), ("smallest",("sort trees from smallest to largest, in number of nodes", Left $ smallest)), ("subtrees",("return all fully applied subtrees (stopping at abstractions), by default sorted from the largest", Left $ concatMap subtrees)), - ("funs",("return all fun functions appearing in the tree, with duplications", + ("funs\t",("return all fun functions appearing in the tree, with duplications", Left $ \es -> [mkApp f [] | e <- es, f <- exprFunctions e])) ] @@ -48,3 +52,18 @@ subtrees :: Expr -> [Expr] subtrees t = t : case unApp t of Just (f,ts) -> concatMap subtrees ts _ -> [] -- don't go under abstractions + +-- Apply transfer function f:C -> D to all maximal subtrees s:C of tree e and replace +-- these s by the values of f(s). This modifies the 'simple-minded transfer' of gf-3.3. +-- If applied to strict subtrees s of e, better use with f:C -> C only. HL 12/2024 + +transfer :: PGF -> CId -> Expr -> Expr +transfer pgf f e = case inferExpr pgf (appf e) of + Left _err -> case e of + EApp g a -> EApp (transfer pgf f g) (transfer pgf f a) + _ -> e + Right _ty -> case (compute pgf (appf e)) of + v | v /= (appf e) -> v + _ -> e -- default case of f, or f has no computation rule + where + appf = EApp (EFun f) From 981d6b9bddacee6a204ac48f2a4e27f4cca1bd47 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 20 Feb 2025 20:52:21 +0100 Subject: [PATCH 20/35] Specify that extending a grammar doesn't inherit the startcat --- doc/tutorial/gf-tutorial.t2t | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index a734a57b6..c4ccb6aab 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1739,6 +1739,13 @@ A new module can **extend** an old one: Pizza : Kind ; } ``` +Note that the extended grammar doesn't inherit the start +category from the grammar it extends, so if you want to +generate sentences with this grammar, you'll have to either +add a startcat (e.g. ``flags startcat = Question ;``), +or in the GF shell, specify the category to ``generate_random`` or ``geneate_trees`` +(e.g. ``gr -cat=Comment`` or ``gt -cat=Question``). + Parallel to the abstract syntax, extensions can be built for concrete syntaxes: ``` From 1037b209ae225d5de604ff832d915c590ced4c38 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 9 Sep 2024 19:38:27 +0200 Subject: [PATCH 21/35] add whitespace on list comprehensions, applications etc. text editor interprets these things as errors (e.g. unterminated qq for list comprehension) and underlines red, even though there is no real error. --- src/compiler/GF/Compile/Compute/Concrete.hs | 18 +++++++++--------- src/compiler/GF/CompileInParallel.hs | 12 ++++++------ src/server/PGFService.hs | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compiler/GF/Compile/Compute/Concrete.hs b/src/compiler/GF/Compile/Compute/Concrete.hs index 47e2f5cde..2f4504ef5 100644 --- a/src/compiler/GF/Compile/Compute/Concrete.hs +++ b/src/compiler/GF/Compile/Compute/Concrete.hs @@ -172,11 +172,11 @@ value env t0 = ImplArg t -> (VImplArg.) # value env t Table p res -> liftM2 VTblType # value env p <# value env res RecType rs -> do lovs <- mapPairsM (value env) rs - return $ \vs->VRecType $ mapSnd ($vs) lovs + return $ \vs->VRecType $ mapSnd ($ vs) lovs t@(ExtR t1 t2) -> ((extR t.)# both id) # both (value env) (t1,t2) FV ts -> ((vfv .) # sequence) # mapM (value env) ts R as -> do lovs <- mapPairsM (value env.snd) as - return $ \ vs->VRec $ mapSnd ($vs) lovs + return $ \ vs->VRec $ mapSnd ($ vs) lovs T i cs -> valueTable env i cs V ty ts -> do pvs <- paramValues env ty ((VV ty pvs .) . sequence) # mapM (value env) ts @@ -376,10 +376,10 @@ valueTable env i cs = where dynamic cs' ty _ = cases cs' # value env ty - cases cs' vty vs = err keep ($vs) (convertv cs' (vty vs)) + cases cs' vty vs = err keep ($ vs) (convertv cs' (vty vs)) where keep msg = --trace (msg++"\n"++render (ppTerm Unqualified 0 (T i cs))) $ - VT wild (vty vs) (mapSnd ($vs) cs') + VT wild (vty vs) (mapSnd ($ vs) cs') wild = case i of TWild _ -> True; _ -> False @@ -392,7 +392,7 @@ valueTable env i cs = convert' cs' ((pty,vs),pvs) = do sts <- mapM (matchPattern cs') vs return $ \ vs -> VV pty pvs $ map (err bug id . valueMatch env) - (mapFst ($vs) sts) + (mapFst ($ vs) sts) valueCase (p,t) = do p' <- measurePatt # inlinePattMacro p pvs <- linPattVars p' @@ -430,19 +430,19 @@ apply' :: CompleteEnv -> Term -> [OpenValue] -> Err OpenValue apply' env t [] = value env t apply' env t vs = case t of - QC x -> return $ \ svs -> VCApp x (map ($svs) vs) + QC x -> return $ \ svs -> VCApp x (map ($ svs) vs) {- Q x@(m,f) | m==cPredef -> return $ let constr = --trace ("predef "++show x) . VApp x in \ svs -> maybe constr id (Map.lookup f predefs) - $ map ($svs) vs + $ map ($ svs) vs | otherwise -> do r <- resource env x - return $ \ svs -> vapply (gloc env) r (map ($svs) vs) + return $ \ svs -> vapply (gloc env) r (map ($ svs) vs) -} App t1 t2 -> apply' env t1 . (:vs) =<< value env t2 _ -> do fv <- value env t - return $ \ svs -> vapply (gloc env) (fv svs) (map ($svs) vs) + return $ \ svs -> vapply (gloc env) (fv svs) (map ($ svs) vs) vapply :: GLocation -> Value -> [Value] -> Value vapply loc v [] = v diff --git a/src/compiler/GF/CompileInParallel.hs b/src/compiler/GF/CompileInParallel.hs index ed498a690..ceb1b99b5 100644 --- a/src/compiler/GF/CompileInParallel.hs +++ b/src/compiler/GF/CompileInParallel.hs @@ -61,11 +61,11 @@ parallelBatchCompile jobs opts rootfiles0 = usesPresent (_,paths) = take 1 libs==["present"] where - libs = [p|path<-paths, - let (d,p0) = splitAt n path - p = dropSlash p0, - d==lib_dir,p `elem` all_modes] - n = length lib_dir + libs = [p | path<-paths, + let (d,p0) = splitAt n path + p = dropSlash p0, + d==lib_dir, p `elem` all_modes] + n = length lib_dir all_modes = ["alltenses","present"] @@ -175,7 +175,7 @@ batchCompile1 lib_dir (opts,filepaths) = " from being compiled." else return (maximum ts,(cnc,gr)) -splitEither es = ([x|Left x<-es],[y|Right y<-es]) +splitEither es = ([x | Left x<-es], [y | Right y<-es]) canonical path = liftIO $ D.canonicalizePath path `catch` const (return path) diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs index 260c2e278..bcf3d32f2 100644 --- a/src/server/PGFService.hs +++ b/src/server/PGFService.hs @@ -448,7 +448,7 @@ pgfMain lcs@(alc,clc) path command tpgf@(t,pgf) = "linearizeTable" -> o =<< doLinearizeTabular pgf # tree % to "random" -> o =<< join (doRandom pgf # cat % depth % limit % to) "generate" -> o =<< doGenerate pgf # cat % depth % limit % to - "translate" -> o =<< doTranslate pgf # input % cat %to%limit%treeopts + "translate" -> o =<< doTranslate pgf # input % cat % to % limit % treeopts "translategroup" -> o =<< doTranslateGroup pgf # input % cat % to % limit "lookupmorpho" -> o =<< doLookupMorpho pgf # from1 % textInput "grammar" -> join $ doGrammar tpgf @@ -1092,7 +1092,7 @@ linearizeTabular pgf (tos,unlex) tree = [(to,lintab to (transfer to tree)) | to <- langs] where langs = if null tos then PGF.languages pgf else tos - lintab to t = [(p,map unlex (nub [t|(p',t)<-vs,p'==p]))|p<-ps] + lintab to t = [(p,map unlex (nub [t | (p',t)<-vs,p'==p])) | p<-ps] where ps = nub (map fst vs) vs = concat (PGF.tabularLinearizes pgf to t) From b914a25de326dd937e3a1d05f4eefb46af6da7b4 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 9 Sep 2024 19:43:39 +0200 Subject: [PATCH 22/35] define return in terms of pure, >> as *>, mappend as <> In preparation for deprecation, see https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid and https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return --- src/compiler/GF/Compile/GeneratePMCFG.hs | 4 ++-- src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs | 4 ++-- src/compiler/GF/CompileInParallel.hs | 6 +++--- src/compiler/GF/Data/BacktrackM.hs | 4 ++-- src/compiler/GF/Data/ErrM.hs | 4 ++-- src/compiler/GF/Grammar/Lexer.x | 4 ++-- src/compiler/GF/Infra/CheckM.hs | 4 ++-- src/compiler/GF/Infra/SIO.hs | 4 ++-- src/runtime/haskell/Data/Binary/Builder.hs | 2 +- src/runtime/haskell/Data/Binary/Get.hs | 4 ++-- src/runtime/haskell/Data/Binary/Put.hs | 14 ++++++++------ src/runtime/haskell/PGF/TypeCheck.hs | 4 ++-- 12 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/compiler/GF/Compile/GeneratePMCFG.hs b/src/compiler/GF/Compile/GeneratePMCFG.hs index 8383f0624..74615dc98 100644 --- a/src/compiler/GF/Compile/GeneratePMCFG.hs +++ b/src/compiler/GF/Compile/GeneratePMCFG.hs @@ -201,11 +201,11 @@ instance Fail.MonadFail CnvMonad where fail = bug instance Applicative CnvMonad where - pure = return + pure a = CM (\gr c s -> c a s) (<*>) = ap instance Monad CnvMonad where - return a = CM (\gr c s -> c a s) + return = pure CM m >>= k = CM (\gr c s -> m gr (\a s -> unCM (k a) gr c s) s) instance MonadState ([ProtoFCat],[Symbol]) CnvMonad where diff --git a/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs b/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs index ed3a20ce0..0e76c3205 100644 --- a/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs +++ b/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs @@ -644,7 +644,7 @@ data TcResult a newtype TcM a = TcM {unTcM :: MetaStore -> [Message] -> TcResult a} instance Monad TcM where - return x = TcM (\ms msgs -> TcOk x ms msgs) + return = pure f >>= g = TcM (\ms msgs -> case unTcM f ms msgs of TcOk x ms msgs -> unTcM (g x) ms msgs TcFail msgs -> TcFail msgs) @@ -659,7 +659,7 @@ instance Fail.MonadFail TcM where instance Applicative TcM where - pure = return + pure x = TcM (\ms msgs -> TcOk x ms msgs) (<*>) = ap instance Functor TcM where diff --git a/src/compiler/GF/CompileInParallel.hs b/src/compiler/GF/CompileInParallel.hs index ceb1b99b5..11f806175 100644 --- a/src/compiler/GF/CompileInParallel.hs +++ b/src/compiler/GF/CompileInParallel.hs @@ -238,12 +238,12 @@ runCO (CO m) = do (o,x) <- m instance Functor m => Functor (CollectOutput m) where fmap f (CO m) = CO (fmap (fmap f) m) -instance (Functor m,Monad m) => Applicative (CollectOutput m) where - pure = return +instance (Functor m,Monad m) => Applicative (CollectOutput m) where + pure x = CO (return (return (),x)) (<*>) = ap instance Monad m => Monad (CollectOutput m) where - return x = CO (return (return (),x)) + return = pure CO m >>= f = CO $ do (o1,x) <- m let CO m2 = f x (o2,y) <- m2 diff --git a/src/compiler/GF/Data/BacktrackM.hs b/src/compiler/GF/Data/BacktrackM.hs index 970de5c06..69bc2c29b 100644 --- a/src/compiler/GF/Data/BacktrackM.hs +++ b/src/compiler/GF/Data/BacktrackM.hs @@ -64,11 +64,11 @@ finalStates :: BacktrackM s () -> s -> [s] finalStates bm = map fst . runBM bm instance Applicative (BacktrackM s) where - pure = return + pure a = BM (\c s b -> c a s b) (<*>) = ap instance Monad (BacktrackM s) where - return a = BM (\c s b -> c a s b) + return = pure BM m >>= k = BM (\c s b -> m (\a s b -> unBM (k a) c s b) s b) where unBM (BM m) = m diff --git a/src/compiler/GF/Data/ErrM.hs b/src/compiler/GF/Data/ErrM.hs index 288c61919..133a49b73 100644 --- a/src/compiler/GF/Data/ErrM.hs +++ b/src/compiler/GF/Data/ErrM.hs @@ -34,7 +34,7 @@ fromErr :: a -> Err a -> a fromErr a = err (const a) id instance Monad Err where - return = Ok + return = pure Ok a >>= f = f a Bad s >>= f = Bad s @@ -54,7 +54,7 @@ instance Functor Err where fmap f (Bad s) = Bad s instance Applicative Err where - pure = return + pure = Ok (<*>) = ap -- | added by KJ diff --git a/src/compiler/GF/Grammar/Lexer.x b/src/compiler/GF/Grammar/Lexer.x index b3d271ddd..248d091a1 100644 --- a/src/compiler/GF/Grammar/Lexer.x +++ b/src/compiler/GF/Grammar/Lexer.x @@ -283,11 +283,11 @@ instance Functor P where fmap = liftA instance Applicative P where - pure = return + pure a = a `seq` (P $ \s -> POk s a) (<*>) = ap instance Monad P where - return a = a `seq` (P $ \s -> POk s a) + return = pure (P m) >>= k = P $ \ s -> case m s of POk s a -> unP (k a) s PFailed posn err -> PFailed posn err diff --git a/src/compiler/GF/Infra/CheckM.hs b/src/compiler/GF/Infra/CheckM.hs index a5ff7148a..1dd26dd5c 100644 --- a/src/compiler/GF/Infra/CheckM.hs +++ b/src/compiler/GF/Infra/CheckM.hs @@ -48,7 +48,7 @@ newtype Check a instance Functor Check where fmap = liftM instance Monad Check where - return x = Check $ \{-ctxt-} ws -> (ws,Success x) + return = pure f >>= g = Check $ \{-ctxt-} ws -> case unCheck f {-ctxt-} ws of (ws,Success x) -> unCheck (g x) {-ctxt-} ws @@ -58,7 +58,7 @@ instance Fail.MonadFail Check where fail = raise instance Applicative Check where - pure = return + pure x = Check $ \{-ctxt-} ws -> (ws,Success x) (<*>) = ap instance ErrorMonad Check where diff --git a/src/compiler/GF/Infra/SIO.hs b/src/compiler/GF/Infra/SIO.hs index 906f39345..7b5a7dac6 100644 --- a/src/compiler/GF/Infra/SIO.hs +++ b/src/compiler/GF/Infra/SIO.hs @@ -52,11 +52,11 @@ newtype SIO a = SIO {unS::PutStr->IO a} instance Functor SIO where fmap = liftM instance Applicative SIO where - pure = return + pure x = SIO (const (pure x)) (<*>) = ap instance Monad SIO where - return x = SIO (const (return x)) + return = pure SIO m1 >>= xm2 = SIO $ \ h -> m1 h >>= \ x -> unS (xm2 x) h instance Fail.MonadFail SIO where diff --git a/src/runtime/haskell/Data/Binary/Builder.hs b/src/runtime/haskell/Data/Binary/Builder.hs index 8dc46f816..e22fa4a4c 100644 --- a/src/runtime/haskell/Data/Binary/Builder.hs +++ b/src/runtime/haskell/Data/Binary/Builder.hs @@ -114,7 +114,7 @@ instance Semigroup Builder where instance Monoid Builder where mempty = empty {-# INLINE mempty #-} - mappend = append + mappend = (<>) {-# INLINE mappend #-} ------------------------------------------------------------------------ diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index a33c5c5a3..ec6309fae 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -127,11 +127,11 @@ instance Functor Get where {-# INLINE fmap #-} instance Applicative Get where - pure = return + pure a = Get (\s -> (a, s)) (<*>) = ap instance Monad Get where - return a = Get (\s -> (a, s)) + return = pure {-# INLINE return #-} m >>= k = Get (\s -> case unGet m s of diff --git a/src/runtime/haskell/Data/Binary/Put.hs b/src/runtime/haskell/Data/Binary/Put.hs index 189cf806f..05d23fba6 100644 --- a/src/runtime/haskell/Data/Binary/Put.hs +++ b/src/runtime/haskell/Data/Binary/Put.hs @@ -77,15 +77,20 @@ instance Functor PutM where {-# INLINE fmap #-} instance Applicative PutM where - pure = return + pure a = Put $ PairS a mempty m <*> k = Put $ let PairS f w = unPut m PairS x w' = unPut k in PairS (f x) (w `mappend` w') + m *> k = Put $ + let PairS _ w = unPut m + PairS b w' = unPut k + in PairS b (w `mappend` w') + {-# INLINE (*>) #-} -- Standard Writer monad, with aggressive inlining instance Monad PutM where - return a = Put $ PairS a mempty + return = pure {-# INLINE return #-} m >>= k = Put $ @@ -94,10 +99,7 @@ instance Monad PutM where in PairS b (w `mappend` w') {-# INLINE (>>=) #-} - m >> k = Put $ - let PairS _ w = unPut m - PairS b w' = unPut k - in PairS b (w `mappend` w') + (>>) = (*>) {-# INLINE (>>) #-} tell :: Builder -> Put diff --git a/src/runtime/haskell/PGF/TypeCheck.hs b/src/runtime/haskell/PGF/TypeCheck.hs index 82bd47b7a..f02986fc0 100644 --- a/src/runtime/haskell/PGF/TypeCheck.hs +++ b/src/runtime/haskell/PGF/TypeCheck.hs @@ -94,11 +94,11 @@ class Selector s where select :: CId -> Scope -> Maybe Int -> TcM s (Expr,TType) instance Applicative (TcM s) where - pure = return + pure x = TcM (\abstr k h -> k x) (<*>) = ap instance Monad (TcM s) where - return x = TcM (\abstr k h -> k x) + return = pure f >>= g = TcM (\abstr k h -> unTcM f abstr (\x -> unTcM (g x) abstr k h) h) instance Selector s => Alternative (TcM s) where From bbf12458c7c4b783897851f7e0bddea54f2d984e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 9 Sep 2024 19:44:49 +0200 Subject: [PATCH 23/35] use openFd from unix >= 2.8 --- gf.cabal | 2 +- src/server/CGIUtils.hs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gf.cabal b/gf.cabal index 21093ae0b..a0b0c01dd 100644 --- a/gf.cabal +++ b/gf.cabal @@ -347,7 +347,7 @@ library else build-depends: terminfo >=0.4.0 && < 0.5, - unix >= 2.7.2 && < 2.8 + unix >= 2.8 if impl(ghc>=8.2) ghc-options: -fhide-source-paths diff --git a/src/server/CGIUtils.hs b/src/server/CGIUtils.hs index 3c5ce2274..b593a2b07 100644 --- a/src/server/CGIUtils.hs +++ b/src/server/CGIUtils.hs @@ -34,8 +34,8 @@ stderrToFile :: FilePath -> IO () stderrToFile file = do let mode = ownerReadMode<>ownerWriteMode<>groupReadMode<>otherReadMode (<>) = unionFileModes - flags = defaultFileFlags { append = True } - fileFd <- openFd file WriteOnly (Just mode) flags + flags = defaultFileFlags { append = True, creat = Just mode } + fileFd <- openFd file WriteOnly flags dupTo fileFd stdError return () #else From e84826ed2aaccde1e5be178f83fc61c1943bb232 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 9 Sep 2024 19:45:34 +0200 Subject: [PATCH 24/35] explicitly import join, when, (<=<) from Control.Monad --- src/compiler/GF/Interactive.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs index 1970533d6..2edb5f3d8 100644 --- a/src/compiler/GF/Interactive.hs +++ b/src/compiler/GF/Interactive.hs @@ -32,6 +32,7 @@ import qualified Text.ParserCombinators.ReadP as RP import System.Directory({-getCurrentDirectory,-}getAppUserDataDirectory) import Control.Exception(SomeException,fromException,evaluate,try) import Control.Monad.State hiding (void) +import Control.Monad (join, when, (<=<)) import qualified GF.System.Signal as IO(runInterruptibly) #ifdef SERVER_MODE import GF.Server(server) From 9fa8ac934a1dbd7f1a59c473e7f37debea012272 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 9 Sep 2024 19:55:05 +0200 Subject: [PATCH 25/35] add stack file for GHC 9.6.6 --- stack-ghc9.6.6.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 stack-ghc9.6.6.yaml diff --git a/stack-ghc9.6.6.yaml b/stack-ghc9.6.6.yaml new file mode 100644 index 000000000..30da45c81 --- /dev/null +++ b/stack-ghc9.6.6.yaml @@ -0,0 +1,7 @@ +resolver: lts-22.29 # GHC-9.6.6 + +extra-deps: +- multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 +- cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 + +allow-newer: true From ab0f09e9f7c7c47096c0667a5708f9d6b8cf312c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 20 Mar 2025 17:53:56 +0100 Subject: [PATCH 26/35] build-depends for unix depending on ghc version --- gf.cabal | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gf.cabal b/gf.cabal index a0b0c01dd..641256b0c 100644 --- a/gf.cabal +++ b/gf.cabal @@ -346,8 +346,14 @@ library Win32 >= 2.3.1.1 && < 2.7 else build-depends: - terminfo >=0.4.0 && < 0.5, - unix >= 2.8 + terminfo >=0.4.0 && < 0.5 + + if impl(ghc >= 9.6.6) + build-depends: unix >= 2.8 + + else + build-depends: unix >= 2.7.2 && < 2.8 + if impl(ghc>=8.2) ghc-options: -fhide-source-paths From 155b9da861fc95e55ec3352e7beb45eba5f41812 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 20 Mar 2025 17:54:41 +0100 Subject: [PATCH 27/35] choose openFd based on version of unix --- src/server/CGIUtils.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/CGIUtils.hs b/src/server/CGIUtils.hs index b593a2b07..0a04c3a6f 100644 --- a/src/server/CGIUtils.hs +++ b/src/server/CGIUtils.hs @@ -34,8 +34,13 @@ stderrToFile :: FilePath -> IO () stderrToFile file = do let mode = ownerReadMode<>ownerWriteMode<>groupReadMode<>otherReadMode (<>) = unionFileModes +#if MIN_VERSION_unix(2,8,0) flags = defaultFileFlags { append = True, creat = Just mode } fileFd <- openFd file WriteOnly flags +#else + flags = defaultFileFlags { append = True } + fileFd <- openFd file WriteOnly (Just mode) flags +#endif dupTo fileFd stdError return () #else From e81d6686052607b5e7f62434a373c06d63975bab Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 20 Mar 2025 17:55:27 +0100 Subject: [PATCH 28/35] higher upper bound for base,mtl,ghc-prim,json,time --- gf.cabal | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gf.cabal b/gf.cabal index 641256b0c..4b7e25a2d 100644 --- a/gf.cabal +++ b/gf.cabal @@ -73,12 +73,12 @@ library build-depends: -- GHC 8.0.2 to GHC 8.10.4 array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.17, + base >= 4.9.1 && < 4.19 , bytestring >= 0.10.8 && < 0.12, containers >= 0.5.7 && < 0.7, exceptions >= 0.8.3 && < 0.11, - ghc-prim >= 0.5.0 && < 0.9.0, - mtl >= 2.2.1 && < 2.3, + ghc-prim >= 0.5.0 && <= 0.10.0, + mtl >= 2.2.1 && <= 2.3.1, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, utf8-string >= 1.0.1.1 && < 1.1 @@ -155,10 +155,10 @@ library directory >= 1.3.0 && < 1.4, filepath >= 1.4.1 && < 1.5, haskeline >= 0.7.3 && < 0.9, - json >= 0.9.1 && < 0.11, + json >= 0.9.1 && <= 0.11, parallel >= 3.2.1.1 && < 3.3, process >= 1.4.3 && < 1.7, - time >= 1.6.0 && < 1.10 + time >= 1.6.0 && <= 1.12.2 hs-source-dirs: src/compiler exposed-modules: From 01c4f82e077b93cb2318830c56070c0ec15a20e6 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 2 Aug 2025 16:42:54 +0200 Subject: [PATCH 29/35] misc small fixes: - update actions/cache to v4 - update haskell/actions/setup to haskell-actions/setup - stack doesn't support ghc < 8.4, remove from CI - don't fail immediately - add -fpermissive flag to gcc - only build 9.6.6 with macos and windows latest - bump base upper bound --- .github/workflows/build-all-versions.yml | 17 +++++++++++------ gf.cabal | 4 ++-- src/runtime/c/configure.ac | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 2bd856b7c..0f3222809 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -12,6 +12,7 @@ jobs: name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] cabal: ["latest"] @@ -19,21 +20,26 @@ jobs: - "8.6.5" - "8.8.3" - "8.10.7" + - "9.6.6" exclude: - os: macos-latest ghc: 8.8.3 - os: macos-latest ghc: 8.6.5 + - os: macos-latest + ghc: 8.10.7 - os: windows-latest ghc: 8.8.3 - os: windows-latest ghc: 8.6.5 + - os: windows-latest + ghc: 8.10.7 steps: - uses: actions/checkout@v2 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' - - uses: haskell/actions/setup@v2 + - uses: haskell-actions/setup@v2 id: setup-haskell-cabal name: Setup Haskell with: @@ -44,7 +50,7 @@ jobs: run: | cabal freeze - - uses: actions/cache@v1 + - uses: actions/cache@v4 name: Cache ~/.cabal/store with: path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} @@ -66,14 +72,13 @@ jobs: strategy: matrix: stack: ["latest"] - ghc: ["7.10.3","8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2"] - # ghc: ["8.8.3"] + ghc: ["8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.6.6"] steps: - uses: actions/checkout@v2 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' - - uses: haskell/actions/setup@v2 + - uses: haskell-actions/setup@v2 name: Setup Haskell Stack with: ghc-version: ${{ matrix.ghc }} @@ -85,7 +90,7 @@ jobs: - run: sed -i.bak 's/"C compiler link flags", "/&-no-pie /' /home/runner/.ghcup/ghc/7.10.3/lib/ghc-7.10.3/settings if: matrix.ghc == '7.10.3' - - uses: actions/cache@v1 + - uses: actions/cache@v4 name: Cache ~/.stack with: path: ~/.stack diff --git a/gf.cabal b/gf.cabal index 4b7e25a2d..ce0682d46 100644 --- a/gf.cabal +++ b/gf.cabal @@ -73,7 +73,7 @@ library build-depends: -- GHC 8.0.2 to GHC 8.10.4 array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.19 , + base >= 4.9.1 && < 4.22, bytestring >= 0.10.8 && < 0.12, containers >= 0.5.7 && < 0.7, exceptions >= 0.8.3 && < 0.11, @@ -398,7 +398,7 @@ test-suite gf-tests main-is: run.hs hs-source-dirs: testsuite build-depends: - base >= 4.9.1 && < 4.16, + base >= 4.9.1, Cabal >= 1.8, directory >= 1.3.0 && < 1.4, filepath >= 1.4.1 && < 1.5, diff --git a/src/runtime/c/configure.ac b/src/runtime/c/configure.ac index 2af669fe2..4e86e5251 100644 --- a/src/runtime/c/configure.ac +++ b/src/runtime/c/configure.ac @@ -30,6 +30,7 @@ AM_PROG_CC_C_O -Wall\ -Wextra\ -Wno-missing-field-initializers\ + -fpermissive\ -Wno-unused-parameter\ -Wno-unused-value" fi] From f5752b345a167d07b4e8565ea3b465c16ea49d7e Mon Sep 17 00:00:00 2001 From: Arianna Masciolini Date: Sat, 2 Aug 2025 19:14:09 +0200 Subject: [PATCH 30/35] fail slow --- .github/workflows/build-all-versions.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 0f3222809..1b5ebe37d 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -70,6 +70,7 @@ jobs: name: stack / ghc ${{ matrix.ghc }} runs-on: ${{ matrix.ghc == '7.10.3' && 'ubuntu-20.04' || 'ubuntu-latest' }} strategy: + fail-fast: false matrix: stack: ["latest"] ghc: ["8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.6.6"] From 6f9f9642d72e0c2313de61bf3348b269a791eb01 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 2 Aug 2025 19:14:15 +0200 Subject: [PATCH 31/35] use UTF8 for several GF files --- gf-book/examples/chapter2/FoodIta.gf | 2 +- gf-book/examples/chapter3/ResIta.gf | 2 +- gf-book/examples/chapter5/LexFoodsFin.gf | 12 ++++++------ gf-book/examples/chapter5/LexFoodsGer.gf | 8 ++++---- gf-book/examples/chapter5/LexFoodsSwe.gf | 6 +++--- gf-book/examples/chapter7/QueryFin.gf | 2 +- gf-book/examples/chapter9/ResIta.gf | 6 +++--- testsuite/canonical/grammars/LexFoodsFin.gf | 8 ++++---- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/gf-book/examples/chapter2/FoodIta.gf b/gf-book/examples/chapter2/FoodIta.gf index 466104432..a50925dcf 100644 --- a/gf-book/examples/chapter2/FoodIta.gf +++ b/gf-book/examples/chapter2/FoodIta.gf @@ -2,7 +2,7 @@ concrete FoodIta of Food = { lincat Comment, Item, Kind, Quality = Str ; lin - Pred item quality = item ++ "è" ++ quality ; + Pred item quality = item ++ "è" ++ quality ; This kind = "questo" ++ kind ; That kind = "quel" ++ kind ; Mod quality kind = kind ++ quality ; diff --git a/gf-book/examples/chapter3/ResIta.gf b/gf-book/examples/chapter3/ResIta.gf index 17809c498..77188198c 100644 --- a/gf-book/examples/chapter3/ResIta.gf +++ b/gf-book/examples/chapter3/ResIta.gf @@ -32,5 +32,5 @@ resource ResIta = open Prelude in { in adjective nero (ner+"a") (ner+"i") (ner+"e") ; copula : Number => Str = - table {Sg => "è" ; Pl => "sono"} ; + table {Sg => "è" ; Pl => "sono"} ; } diff --git a/gf-book/examples/chapter5/LexFoodsFin.gf b/gf-book/examples/chapter5/LexFoodsFin.gf index 4cf26511a..1f8dfd030 100644 --- a/gf-book/examples/chapter5/LexFoodsFin.gf +++ b/gf-book/examples/chapter5/LexFoodsFin.gf @@ -8,13 +8,13 @@ instance LexFoodsFin of LexFoods = cheese_N = mkN "juusto" ; fish_N = mkN "kala" ; fresh_A = mkA "tuore" ; - warm_A = mkA - (mkN "lämmin" "lämpimän" "lämmintä" "lämpimänä" "lämpimään" - "lämpiminä" "lämpimiä" "lämpimien" "lämpimissä" "lämpimiin" - ) - "lämpimämpi" "lämpimin" ; + warm_A = mkA + (mkN "lämmin" "lämpimän" "lämmintä" "lämpimänä" "lämpimään" + "lämpiminä" "lämpimiä" "lämpimien" "lämpimissä" "lämpimiin" + ) + "lämpimämpi" "lämpimin" ; italian_A = mkA "italialainen" ; expensive_A = mkA "kallis" ; delicious_A = mkA "herkullinen" ; - boring_A = mkA "tylsä" ; + boring_A = mkA "tylsä" ; } diff --git a/gf-book/examples/chapter5/LexFoodsGer.gf b/gf-book/examples/chapter5/LexFoodsGer.gf index a420e22d3..a1791172a 100644 --- a/gf-book/examples/chapter5/LexFoodsGer.gf +++ b/gf-book/examples/chapter5/LexFoodsGer.gf @@ -1,16 +1,16 @@ -- (c) 2009 Aarne Ranta under LGPL -instance LexFoodsGer of LexFoods = +instance LexFoodsGer of LexFoods = open SyntaxGer, ParadigmsGer in { oper wine_N = mkN "Wein" ; pizza_N = mkN "Pizza" "Pizzen" feminine ; - cheese_N = mkN "Käse" "Käse" masculine ; + cheese_N = mkN "Käse" "Käse" masculine ; fish_N = mkN "Fisch" ; fresh_A = mkA "frisch" ; - warm_A = mkA "warm" "wärmer" "wärmste" ; + warm_A = mkA "warm" "wärmer" "wärmste" ; italian_A = mkA "italienisch" ; expensive_A = mkA "teuer" ; - delicious_A = mkA "köstlich" ; + delicious_A = mkA "köstlich" ; boring_A = mkA "langweilig" ; } diff --git a/gf-book/examples/chapter5/LexFoodsSwe.gf b/gf-book/examples/chapter5/LexFoodsSwe.gf index 72e7e3e86..e9cac00d8 100644 --- a/gf-book/examples/chapter5/LexFoodsSwe.gf +++ b/gf-book/examples/chapter5/LexFoodsSwe.gf @@ -7,10 +7,10 @@ instance LexFoodsSwe of LexFoods = pizza_N = mkN "pizza" ; cheese_N = mkN "ost" ; fish_N = mkN "fisk" ; - fresh_A = mkA "färsk" ; + fresh_A = mkA "färsk" ; warm_A = mkA "varm" ; italian_A = mkA "italiensk" ; expensive_A = mkA "dyr" ; - delicious_A = mkA "läcker" ; - boring_A = mkA "tråkig" ; + delicious_A = mkA "läcker" ; + boring_A = mkA "trÃ¥kig" ; } diff --git a/gf-book/examples/chapter7/QueryFin.gf b/gf-book/examples/chapter7/QueryFin.gf index b3461e34a..03490ae88 100644 --- a/gf-book/examples/chapter7/QueryFin.gf +++ b/gf-book/examples/chapter7/QueryFin.gf @@ -6,7 +6,7 @@ concrete QueryFin of Query = { Odd = pred "pariton" ; Prime = pred "alkuluku" ; Number i = i.s ; - Yes = "kyllä" ; + Yes = "kyllä" ; No = "ei" ; oper pred : Str -> Str -> Str = \f,x -> "onko" ++ x ++ f ; diff --git a/gf-book/examples/chapter9/ResIta.gf b/gf-book/examples/chapter9/ResIta.gf index f39db69f9..28d7bc424 100644 --- a/gf-book/examples/chapter9/ResIta.gf +++ b/gf-book/examples/chapter9/ResIta.gf @@ -43,10 +43,10 @@ oper } ; auxVerb : Aux -> Verb = \a -> case a of { - Avere => + Avere => mkVerb "avere" "ho" "hai" "ha" "abbiamo" "avete" "hanno" "avuto" Avere ; - Essere => - mkVerb "essere" "sono" "sei" "è" "siamo" "siete" "sono" "stato" Essere + Essere => + mkVerb "essere" "sono" "sei" "è" "siamo" "siete" "sono" "stato" Essere } ; agrPart : Verb -> Agr -> ClitAgr -> Str = \v,a,c -> case v.aux of { diff --git a/testsuite/canonical/grammars/LexFoodsFin.gf b/testsuite/canonical/grammars/LexFoodsFin.gf index 8b12f449f..bc79b740a 100644 --- a/testsuite/canonical/grammars/LexFoodsFin.gf +++ b/testsuite/canonical/grammars/LexFoodsFin.gf @@ -10,12 +10,12 @@ instance LexFoodsFin of LexFoods = fish_N = mkN "kala" ; fresh_A = mkA "tuore" ; warm_A = mkA - (mkN "l�mmin" "l�mpim�n" "l�mmint�" "l�mpim�n�" "l�mpim��n" - "l�mpimin�" "l�mpimi�" "l�mpimien" "l�mpimiss�" "l�mpimiin" + (mkN "lämmin" "lämpimän" "lämmintä" "lämpimänä" "lämpimään" + "lämpiminä" "lämpimiä" "lämpimien" "lämpimissä" "lämpimiin" ) - "l�mpim�mpi" "l�mpimin" ; + "lämpimämpi" "lämpimin" ; italian_A = mkA "italialainen" ; expensive_A = mkA "kallis" ; delicious_A = mkA "herkullinen" ; - boring_A = mkA "tyls�" ; + boring_A = mkA "tylsä" ; } From 703b1e5d925a7e497f98f18b26bb16e7ca0f95b2 Mon Sep 17 00:00:00 2001 From: Arianna Masciolini Date: Sat, 2 Aug 2025 20:18:28 +0200 Subject: [PATCH 32/35] add eval.gfs to expected failures --- testsuite/run.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/run.hs b/testsuite/run.hs index f8e6bf49f..287665fd4 100644 --- a/testsuite/run.hs +++ b/testsuite/run.hs @@ -66,6 +66,7 @@ expectedFailures = [ "testsuite/runtime/parser/parser.gfs" -- Only parses `z` as `zero` and not also as e.g. `succ zero` as expected , "testsuite/runtime/linearize/brackets.gfs" -- Missing "cannot linearize in the end" , "testsuite/compiler/typecheck/abstract/non-abstract-terms.gfs" -- Gives a different error than expected + , "testsuite/runtime/eval/eval.gfs" ] -- | Produce HTML document with test results From 52df0ed4fe3e33604fb5cd8424c58a194bcc7b6d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 2 Aug 2025 19:39:29 +0200 Subject: [PATCH 33/35] replace 9.6.6 with 9.6.7 --- .github/workflows/build-all-versions.yml | 4 ++-- stack-ghc9.6.6.yaml | 7 ------- stack-ghc9.6.7.yaml | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) delete mode 100644 stack-ghc9.6.6.yaml create mode 100644 stack-ghc9.6.7.yaml diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 0f3222809..dfaaa32df 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -20,7 +20,7 @@ jobs: - "8.6.5" - "8.8.3" - "8.10.7" - - "9.6.6" + - "9.6.7" exclude: - os: macos-latest ghc: 8.8.3 @@ -72,7 +72,7 @@ jobs: strategy: matrix: stack: ["latest"] - ghc: ["8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.6.6"] + ghc: ["8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.6.7"] steps: - uses: actions/checkout@v2 diff --git a/stack-ghc9.6.6.yaml b/stack-ghc9.6.6.yaml deleted file mode 100644 index 30da45c81..000000000 --- a/stack-ghc9.6.6.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-22.29 # GHC-9.6.6 - -extra-deps: -- multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 -- cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 - -allow-newer: true diff --git a/stack-ghc9.6.7.yaml b/stack-ghc9.6.7.yaml new file mode 100644 index 000000000..f55acd828 --- /dev/null +++ b/stack-ghc9.6.7.yaml @@ -0,0 +1,20 @@ +resolver: ghc-9.6.7 + +extra-deps: +- multipart-0.2.1@sha256:559c04eed5218a9673e9fb6a225287fee1aeb38a45a0caf91a2598967bd75659,1150 +- cgi-3001.5.1.0@sha256:408e1f96ac6134965484c891b5fae35c7303fa841b09ce5baea52ddb078eef6b,3442 +- alex-3.5.3.0@sha256:f6fde8ff59e7e38f9e95eca8f5154fb611c9789d1d9538aa9745c6c3cd9495b4,4502 +- happy-2.1.6@sha256:1e963a137b650e766d1d0433e3404727fd64bebb850aa587702bfe199347f6da,5017 +- happy-lib-2.1.6@sha256:552a82e07605d6f8017f513be59b43219425aa0e4be71f9dddb2527f5accbce4,6081 +- httpd-shed-0.4.1.2@sha256:ab0fbd57acd32e0d5a5f7402dcc23192a1ffa142d86eeed051f59cf54a74ce38,1838 +- json-0.11@sha256:3afa37628415992fe648da6f002672f5a0119aa5d49022bf928d10a927c29318,3250 +- network-3.1.4.0@sha256:e152cdb03243afb52bbc740cfbe96905ca298a6f6342f0c47b3f2e227ff19def,5208 +- network-bsd-2.8.1.0@sha256:cc7867f81c6eb3f1924bbb1029757af6e3b67a3c224c1faa329be3ea70ad729c,3780 +- network-uri-2.6.4.2@sha256:6fffb57373962b5651a2db8b0af732098b3bf029a7ced76a9855615de2026588,3217 +- parallel-3.2.2.0@sha256:9d7b34ac537940f67732eca31d48a43bd78fb65a91baebddf63bee4fc3813d81,1961 +- random-1.2.1.3@sha256:117541ba0a177397a3333f94870f789ef050dca31b0688a19824b2bc401b8823,6237 +- splitmix-0.1.3.1@sha256:d0002f3fb16a2cc5ba8afd47a6657726386edccfe8853d310e3479fe3b45201b,6552 +- stringsearch-0.3.6.6@sha256:cd72bb03946006b18a6a374b7dc4a1c783a29df1889861604f95b1de1da98607,4258 +- syb-0.7.2.4@sha256:936d5a92084ad9d88c5a9dd2e622deab57ce48ce85be93e6273b3f8eb64c12ca,3872 +- th-compat-0.1.6@sha256:e83d97946f84fe492762ceb3b4753b4770c78b0b70e594078700baa91a5106c2,2885 +- utf8-string-1.0.2@sha256:79416292186feeaf1f60e49ac5a1ffae9bf1b120e040a74bf0e81ca7f1d31d3f,1538 From 218c61b004df3afa3cbb1768cc632689464adfca Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 2 Aug 2025 20:35:39 +0200 Subject: [PATCH 34/35] make 9.6.7 into default stack.yaml --- stack.yaml | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/stack.yaml b/stack.yaml index 128b91f8a..05fda20a5 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,15 +1,23 @@ -# This default stack file is a copy of stack-ghc8.10.7.yaml +# This default stack file is a copy of stack-ghc9.6.7.yaml # But committing a symlink can be problematic on Windows, so it's a real copy. # See: https://github.com/GrammaticalFramework/gf-core/pull/106 -resolver: lts-18.27 # ghc 8.10.7 +resolver: ghc-9.6.7 extra-deps: -- network-2.6.3.6 -- httpd-shed-0.4.0.3 - -# flags: -# gf: -# server: true -# c-runtime: true -# extra-lib-dirs: -# - /usr/local/lib +- multipart-0.2.1@sha256:559c04eed5218a9673e9fb6a225287fee1aeb38a45a0caf91a2598967bd75659,1150 +- cgi-3001.5.1.0@sha256:408e1f96ac6134965484c891b5fae35c7303fa841b09ce5baea52ddb078eef6b,3442 +- alex-3.5.3.0@sha256:f6fde8ff59e7e38f9e95eca8f5154fb611c9789d1d9538aa9745c6c3cd9495b4,4502 +- happy-2.1.6@sha256:1e963a137b650e766d1d0433e3404727fd64bebb850aa587702bfe199347f6da,5017 +- happy-lib-2.1.6@sha256:552a82e07605d6f8017f513be59b43219425aa0e4be71f9dddb2527f5accbce4,6081 +- httpd-shed-0.4.1.2@sha256:ab0fbd57acd32e0d5a5f7402dcc23192a1ffa142d86eeed051f59cf54a74ce38,1838 +- json-0.11@sha256:3afa37628415992fe648da6f002672f5a0119aa5d49022bf928d10a927c29318,3250 +- network-3.1.4.0@sha256:e152cdb03243afb52bbc740cfbe96905ca298a6f6342f0c47b3f2e227ff19def,5208 +- network-bsd-2.8.1.0@sha256:cc7867f81c6eb3f1924bbb1029757af6e3b67a3c224c1faa329be3ea70ad729c,3780 +- network-uri-2.6.4.2@sha256:6fffb57373962b5651a2db8b0af732098b3bf029a7ced76a9855615de2026588,3217 +- parallel-3.2.2.0@sha256:9d7b34ac537940f67732eca31d48a43bd78fb65a91baebddf63bee4fc3813d81,1961 +- random-1.2.1.3@sha256:117541ba0a177397a3333f94870f789ef050dca31b0688a19824b2bc401b8823,6237 +- splitmix-0.1.3.1@sha256:d0002f3fb16a2cc5ba8afd47a6657726386edccfe8853d310e3479fe3b45201b,6552 +- stringsearch-0.3.6.6@sha256:cd72bb03946006b18a6a374b7dc4a1c783a29df1889861604f95b1de1da98607,4258 +- syb-0.7.2.4@sha256:936d5a92084ad9d88c5a9dd2e622deab57ce48ce85be93e6273b3f8eb64c12ca,3872 +- th-compat-0.1.6@sha256:e83d97946f84fe492762ceb3b4753b4770c78b0b70e594078700baa91a5106c2,2885 +- utf8-string-1.0.2@sha256:79416292186feeaf1f60e49ac5a1ffae9bf1b120e040a74bf0e81ca7f1d31d3f,1538 From 8c89ba4e76043efc3ba644a5436e92a4624456f7 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 2 Aug 2025 20:36:03 +0200 Subject: [PATCH 35/35] convert editor-modes into markdown --- doc/gf-editor-modes.md | 75 ++++++++++++++++++++++++++++++++++++++ doc/gf-editor-modes.t2t | 81 ----------------------------------------- 2 files changed, 75 insertions(+), 81 deletions(-) create mode 100644 doc/gf-editor-modes.md delete mode 100644 doc/gf-editor-modes.t2t diff --git a/doc/gf-editor-modes.md b/doc/gf-editor-modes.md new file mode 100644 index 000000000..5351895e0 --- /dev/null +++ b/doc/gf-editor-modes.md @@ -0,0 +1,75 @@ +# Editor modes & IDE integration for GF + +We collect GF modes for various editors on this page. Contributions are welcome! + +## Emacs + +[gf.el](https://github.com/GrammaticalFramework/gf-emacs-mode) by Johan +BockgÃ¥rd provides syntax highlighting and automatic indentation and +lets you run the GF Shell in an emacs buffer. See installation +instructions inside. + +## Atom + +[language-gf](https://atom.io/packages/language-gf), by John J. Camilleri + +## Visual Studio Code + +* [Grammatical Framework Language Server](https://marketplace.visualstudio.com/items?itemName=anka-213.gf-vscode) by Andreas Källberg. +This provides syntax highlighting and a client for the Grammatical Framework language server. Follow the installation instructions in the link. +* [Grammatical Framework](https://marketplace.visualstudio.com/items?itemName=GrammaticalFramework.gf-vscode) is a simpler extension +without any external dependencies which provides only syntax highlighting. + +## Eclipse + +[GF Eclipse Plugin](https://github.com/GrammaticalFramework/gf-eclipse-plugin/), by John J. Camilleri + +## Gedit + +By John J. Camilleri + +Copy the file below to +`~/.local/share/gtksourceview-3.0/language-specs/gf.lang` (under Ubuntu). + + * [gf.lang](../src/tools/gf.lang) + +Some helpful notes/links: + + * The code is based heavily on the `haskell.lang` file which I found in +`/usr/share/gtksourceview-2.0/language-specs/haskell.lang`. + * Ruslan Osmanov recommends +[registering your file extension as its own MIME type](http://osmanov-dev-notes.blogspot.com/2011/04/how-to-add-new-highlight-mode-in-gedit.html) +(see also [here](https://help.ubuntu.com/community/AddingMimeTypes)), +however on my system the `.gf` extension was already registered +as a generic font (`application/x-tex-gf`) and I didn't want to risk +messing any of that up. + * This is a quick 5-minute job and might require some tweaking. +[The GtkSourceView language definition tutorial](http://developer.gnome.org/gtksourceview/stable/lang-tutorial.html) +is the place to start looking. + * Contributions are welcome! + +## Geany + +By John J. Camilleri + +[Custom filetype](http://www.geany.org/manual/dev/index.html#custom-filetypes) +config files for syntax highlighting in [Geany](http://www.geany.org/). + +For version 1.36 and above, copy one of the files below to +`/usr/share/geany/filedefs/filetypes.GF.conf` (under Ubuntu). +If you're using a version older than 1.36, copy the file to `/usr/share/geany/filetypes.GF.conf`. +You will need to manually create the file. + + * [light-filetypes.GF.conf](../src/tools/light-filetypes.GF.conf) + * [dark-filetypes.GF.conf](../src/tools/dark-filetypes.GF.conf) + +You will also need to edit the `filetype_extensions.conf` file and add the +following line somewhere: + +``` +GF=*.gf +``` + +## Vim + +[vim-gf](https://github.com/gdetrez/vim-gf) \ No newline at end of file diff --git a/doc/gf-editor-modes.t2t b/doc/gf-editor-modes.t2t deleted file mode 100644 index 4ff15520d..000000000 --- a/doc/gf-editor-modes.t2t +++ /dev/null @@ -1,81 +0,0 @@ -Editor modes & IDE integration for GF - - -We collect GF modes for various editors on this page. Contributions are -welcome! - - -==Emacs== - -[gf.el https://github.com/GrammaticalFramework/gf-emacs-mode] by Johan -BockgÃ¥rd provides syntax highlighting and automatic indentation and -lets you run the GF Shell in an emacs buffer. See installation -instructions inside. - -==Atom== -[language-gf https://atom.io/packages/language-gf], by John J. Camilleri - -==Visual Studio Code== - -- [Grammatical Framework Language Server https://marketplace.visualstudio.com/items?itemName=anka-213.gf-vscode] by Andreas Källberg. - This provides syntax highlighting and a client for the Grammatical Framework language server. Follow the installation instructions in the link. -- [Grammatical Framework https://marketplace.visualstudio.com/items?itemName=GrammaticalFramework.gf-vscode] is a simpler extension - without any external dependencies which provides only syntax highlighting. - -==Eclipse== - -[GF Eclipse Plugin https://github.com/GrammaticalFramework/gf-eclipse-plugin/], by John J. Camilleri - -==Gedit== - -By John J. Camilleri - -Copy the file below to -``~/.local/share/gtksourceview-3.0/language-specs/gf.lang`` (under Ubuntu). - -- [gf.lang ../src/tools/gf.lang] - - -Some helpful notes/links: - -- The code is based heavily on the ``haskell.lang`` file which I found in - ``/usr/share/gtksourceview-2.0/language-specs/haskell.lang``. -- Ruslan Osmanov recommends - [registering your file extension as its own MIME type http://osmanov-dev-notes.blogspot.com/2011/04/how-to-add-new-highlight-mode-in-gedit.html] - (see also [here https://help.ubuntu.com/community/AddingMimeTypes]), - however on my system the ``.gf`` extension was already registered - as a generic font (``application/x-tex-gf``) and I didn't want to risk - messing any of that up. -- This is a quick 5-minute job and might require some tweaking. - [The GtkSourceView language definition tutorial http://developer.gnome.org/gtksourceview/stable/lang-tutorial.html] - is the place to start looking. -- Contributions are welcome! - - -==Geany== - -By John J. Camilleri - -[Custom filetype http://www.geany.org/manual/dev/index.html#custom-filetypes] -config files for syntax highlighting in [Geany http://www.geany.org/]. - -For version 1.36 and above, copy one of the files below to -``/usr/share/geany/filedefs/filetypes.GF.conf`` (under Ubuntu). -If you're using a version older than 1.36, copy the file to ``/usr/share/geany/filetypes.GF.conf``. -You will need to manually create the file. - -- [light-filetypes.GF.conf ../src/tools/light-filetypes.GF.conf] -- [dark-filetypes.GF.conf ../src/tools/dark-filetypes.GF.conf] - - -You will also need to edit the ``filetype_extensions.conf`` file and add the -following line somewhere: - -``` -GF=*.gf -``` - - -==Vim== - -[vim-gf https://github.com/gdetrez/vim-gf]