express 1.0.16 → 1.0.18
raw patch · 11 files changed
+142/−70 lines, 11 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- .github/workflows/build.yml +90/−49
- Makefile +3/−0
- changelog.md +12/−0
- express.cabal +5/−5
- mk/haskell.mk +4/−0
- src/Data/Express.hs +1/−1
- src/Data/Express/Match.hs +6/−0
- stack.yaml +1/−4
- test/express-derive.hs +7/−7
- test/match.hs +9/−0
- test/name-derive.hs +4/−4
.github/workflows/build.yml view
@@ -11,103 +11,123 @@ build-and-test: runs-on: ubuntu-latest steps:+ - run: git --version+ - run: make --version+ - run: ghc --version+ - run: cabal --version - - name: Cache ~/.cabal/packages+ - name: Check out repository+ uses: actions/checkout@v3++ # check out needs to happen before cache so that hashing works+ - name: Cache hash+ run: echo Cache hash = ${{ hashFiles('*.cabal') }}++ - name: Cache cabal (source) packages uses: actions/cache@v3 with:- path: ~/.cabal/packages+ path: |+ ~/.cabal/packages+ ~/.cache/cabal key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - - name: Cache ~/.cabal and ~/.ghc+ - name: Cache installed cabal packages uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages+ ~/.config/cabal+ ~/.local/state/cabal ~/.ghc key: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }}- restore-keys: v1-${{ runner.os }}-cabal-ghc-latest--- - run: du -hd3 ~/.cabal ~/.ghc || true-- - run: make --version+ restore-keys: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }}+ # restore with exact match has some versions of cabal have trouble updating - run: haddock --version || sudo apt-get install ghc-haddock- - run: ghc --version- - run: cabal --version- - run: haddock --version- - run: ghc-pkg list-- - name: Check out repository- uses: actions/checkout@v3+ # blank line+ # blank line for alignment with matrix scripts - - run: git --version+ - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true + - run: ghc-pkg list - run: make install-dependencies+ - run: ghc-pkg list - # 2023-07: some projects were failing with missing base for GHC 9.6.- # Here we compile through cabal only provisionally.- # - run: make- # - run: make test- # - run: make haddock+ - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true++ - run: make+ - run: make test+ - run: make haddock - run: make test-sdist- #- run: make test-via-cabal- - run: cabal configure --enable-tests --enable-benchmarks --ghc-options="-O0"- - run: cabal build- - run: cabal test- - run: cabal haddock+ - run: make test-via-cabal test-with-ghc: strategy:+ max-parallel: 6 matrix:+ # starting with 9.10, docker/_/haskell requires -bullseye as suffix ghc:+ - '9.10-bullseye' - '9.8' - '9.6' - '9.4' - '9.2' - '9.0' - '8.10'- - '8.6'- - '8.2'+ - '8.8' runs-on: ubuntu-latest needs: build-and-test container: haskell:${{ matrix.ghc }} steps:- - name: Cache ~/.cabal/packages+ - run: git --version || true # git is missing in some images+ - run: make --version || true # make is missing in some images+ - run: ghc --version+ - run: cabal --version++ - name: Check out repository+ uses: actions/checkout@v3++ # check out needs to happen before cache so that hashing works+ - name: Cache hash+ run: echo Cache hash = ${{ hashFiles('*.cabal') }}++ - name: Cache cabal (source) packages uses: actions/cache@v3 with:- path: ~/.cabal/packages+ path: |+ ~/.cabal/packages+ ~/.cache/cabal key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - - name: Cache ~/.cabal and ~/.ghc+ - name: Cache installed cabal packages uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages+ ~/.config/cabal+ ~/.local/state/cabal ~/.ghc key: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }}- restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}--- - run: du -hd3 ~/.cabal ~/.ghc || true+ restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }}+ # restore with exact match has some versions of cabal have trouble updating - run: make --version || rm /etc/apt/sources.list.d/*.list # faster update - run: make --version || apt-get update - run: make --version || apt-get install make - - run: ghc --version- - run: cabal --version- - run: haddock --version- - run: ghc-pkg list-- - name: Check out repository- uses: actions/checkout@v3+ - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true + - run: ghc-pkg list - run: make install-dependencies+ - run: ghc-pkg list + - run: du -hd3 ~/.ghc ~/.cabal ~/.config/cabal ~/.cache/cabal ~/.local/state/cabal || true+ - run: make - run: make test - run: make haddock@@ -118,23 +138,44 @@ runs-on: ubuntu-latest needs: build-and-test steps:- - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS- uses: haskell-actions/setup@v2- with: # lts-19.19- ghc-version: '9.0.2'- cabal-version: '3.4'+ - name: Check out repository+ uses: actions/checkout@v3 - - uses: actions/cache@v3+ # check out needs to happen before cache so that hashing works+ - name: Cache hash+ run: echo Cache hash = ${{ hashFiles('stack.yaml') }}++ - name: Cache stack folder+ uses: actions/cache@v3 with: path: ~/.stack key: v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }} restore-keys: v1-${{ runner.os }}-stack- + - name: Cache ghcup folder+ uses: actions/cache@v3+ with:+ path: |+ ~/.ghcup+ /usr/local/.ghcup/bin+ /usr/local/.ghcup/db+ /usr/local/.ghcup/ghc/9.0.2+ key: v1-${{ runner.os }}-ghcup-${{ hashFiles('stack.yaml') }}+ restore-keys: v1-${{ runner.os }}-ghcup-++ - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS+ uses: haskell-actions/setup@v2+ with: # lts-21.25+ ghc-version: '9.4.8'+ cabal-version: '3.8'++ - run: du -hd2 ~/.stack ~/.ghcup /usr/local/.ghcup || true+ - run: stack --version - - name: Check out repository- uses: actions/checkout@v3 - run: make test-via-stack++ - run: du -hd2 ~/.stack ~/.ghcup /usr/local/.ghcup || true test-with-hugs: runs-on: ubuntu-latest
Makefile view
@@ -110,6 +110,9 @@ test-via-everything: test test-via-cabal test-via-stack +test-on-ghc-9.10:+ make test GHC=ghc-9.10 GHCIMPORTDIRS=src:test:../leancheck/src+ legacy-test: # needs ghc-8.8 .. ghc-7.8 installed as such make clean && make test -j GHC=ghc-8.8 make clean && make test -j GHC=ghc-8.6
changelog.md view
@@ -2,6 +2,18 @@ ===================== +v1.0.18 (January 2025)+----------------------++* No changes the API.++* Minor improvements in Haddock documentation.++* Fix build of tests on GHC >= 9.10. (Libs unaffected)++* Rework CI scripts and add a couple more tests.++ v1.0.16 (February 2024) -----------------------
express.cabal view
@@ -1,6 +1,6 @@ -- Cabal file for express name: express-version: 1.0.16+version: 1.0.18 synopsis: Dynamically-typed expressions involving function application and variables. description: Express is a library for manipulating dynamically typed Haskell expressions.@@ -44,14 +44,14 @@ , bench/runtime/zero/bench/*.runtime , bench/runtime/zero/eg/*.runtime , etc/hugs-backports/Data/Function.hs-tested-with: GHC==9.8+tested-with: GHC==9.10+ , GHC==9.8 , GHC==9.6 , GHC==9.4 , GHC==9.2 , GHC==9.0 , GHC==8.10- , GHC==8.6- , GHC==8.2+ , GHC==8.8 , Hugs==2006.9 -- for Hugs, not all modules are supported, see test/typecheck.hs @@ -62,7 +62,7 @@ source-repository this type: git location: https://github.com/rudymatela/express- tag: v1.0.16+ tag: v1.0.18 library exposed-modules: Data.Express
mk/haskell.mk view
@@ -91,10 +91,14 @@ install-dependencies: if [ -n "$(INSTALL_DEPS)" ]; then \+ cd ~ && \ cabal update && \ $(CABAL_INSTALL) $(INSTALL_DEPS) || true; \ fi # above, "|| true" is needed for cabal >= 3.10.2+ # Before, cabal would successfully skip installation+ # of already existing packages+ # cd ~ is needed so cabal installs only dependencies # haddock rules haddock: doc/index.html
src/Data/Express.hs view
@@ -112,7 +112,7 @@ -- There may still be a /m/ cost associated with the values stored in 'Expr's. {-# LANGUAGE CPP #-} module Data.Express- ( + ( -- -- -- Data.Express.Core exports -- -- -- -- * The Expr datatype
src/Data/Express/Match.hs view
@@ -93,6 +93,12 @@ -- > (yy -+- (yy -+- xx)) `isInstanceOf` (xx -+- yy) = True -- > (zero -+- (yy -+- xx)) `isInstanceOf` (zero -+- yy) = True -- > (one -+- (yy -+- xx)) `isInstanceOf` (zero -+- yy) = False+--+-- This function works on ill-typed expressions+-- so long as the leaf/atom types match:+--+-- > > foldPair (xx -+- zero, xx) `isInstanceOf` foldPair (yy -+- zero, yy)+-- > True isInstanceOf :: Expr -> Expr -> Bool e1 `isInstanceOf` e2 = isJust $ e1 `match` e2
stack.yaml view
@@ -1,7 +1,4 @@-resolver: lts-19.19 # or ghc-9.0.2+resolver: lts-21.25 # or ghc-9.4.8 packages: - .--extra-deps:-- leancheck-1.0.0
test/express-derive.hs view
@@ -8,19 +8,19 @@ data Choice = Ae | Bee | Cee deriving (Show, Eq, Typeable) data Peano = Zero | Succ Peano deriving (Show, Eq, Typeable)-data List a = a :- List a | Nil deriving (Show, Eq, Typeable)+data Lst a = a :- Lst a | Nil deriving (Show, Eq, Typeable) data Bush a = Bush a :-: Bush a | Leaf a deriving (Show, Eq, Typeable) data Tree a = Node (Tree a) a (Tree a) | Null deriving (Show, Eq, Typeable) deriveExpress ''Choice deriveExpress ''Peano-deriveExpress ''List+deriveExpress ''Lst deriveExpress ''Bush deriveExpress ''Tree deriveListable ''Choice deriveListable ''Peano-deriveListable ''List+deriveListable ''Lst deriveListable ''Bush deriveListable ''Tree @@ -73,8 +73,8 @@ , holds n (exprIsVal :: Choice -> Bool) , fails n (exprIsVal :: Peano -> Bool) - , fails n (exprIsVal :: List Int -> Bool)- , fails n (exprIsVal :: List Bool -> Bool)+ , fails n (exprIsVal :: Lst Int -> Bool)+ , fails n (exprIsVal :: Lst Bool -> Bool) , fails n (exprIsVal :: Bush Int -> Bool) , fails n (exprIsVal :: Bush Bool -> Bool)@@ -85,8 +85,8 @@ , holds n (exprIsValUnderEvaluate :: Choice -> Bool) , holds n (exprIsValUnderEvaluate :: Peano -> Bool) - , holds n (exprIsValUnderEvaluate :: List Int -> Bool)- , holds n (exprIsValUnderEvaluate :: List Bool -> Bool)+ , holds n (exprIsValUnderEvaluate :: Lst Int -> Bool)+ , holds n (exprIsValUnderEvaluate :: Lst Bool -> Bool) , holds n (exprIsValUnderEvaluate :: Bush Int -> Bool) , holds n (exprIsValUnderEvaluate :: Bush Bool -> Bool)
test/match.hs view
@@ -28,6 +28,15 @@ , (xx -+- (xx -+- xx)) `isInstanceOf` (xx -+- yy) , not $ (xx -+- (xx -+- xx)) `isInstanceOf` (xx -+- xx) + , foldPair (xx -+- zero, xx) `isInstanceOf`+ foldPair (yy -+- zero, yy)++ , not $ foldPair (xx -+- zero, xx) `isInstanceOf`+ foldPair (yy, yy -+- zero)++ , (xx -:- xxs) `isInstanceOf` (yy -:- yys)+ , not $ (xx -:- xxs) `isInstanceOf` (pp -:- pps)+ , holds n $ \(IntE e1) (IntE e2) -> match (e1 -+- e2) (xx -+- yy) == Just [(yy,e2),(xx,e1)] , holds n $ \(IntE e) -> match (e -+- e) (xx -+- xx) == Just [(xx,e)] , holds n $ \(IntE e1) (IntE e2) -> e1 /= e2 ==> match (e1 -+- e2) (xx -+- xx) == Nothing
test/name-derive.hs view
@@ -7,7 +7,7 @@ import Data.Express.Utils.List data Peano = Zero | Succ Peano deriving Show-data List a = a :- List a | Nil deriving Show+data Lst a = a :- Lst a | Nil deriving Show data Bush a = Bush a :-: Bush a | Leaf a deriving (Show, Eq) data Tree a = Node (Tree a) a (Tree a) | Null deriving (Show, Eq) @@ -25,7 +25,7 @@ Succ n - Succ m = n - m deriveName ''Peano-deriveName ''List+deriveName ''Lst deriveName ''Bush deriveName ''Tree @@ -56,10 +56,10 @@ [ True , name (undefined :: Peano) == "x"- , name (undefined :: List Int) == "l"+ , name (undefined :: Lst Int) == "l" , name (undefined :: Bush Int) == "b" , name (undefined :: Tree Int) == "t"- , name (undefined :: List Bool) == "l"+ , name (undefined :: Lst Bool) == "l" , name (undefined :: Bush Bool) == "b" , name (undefined :: Tree Bool) == "t"