From 4d1395688b69b762120e6101c9ea7f4007328508 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 15 Apr 2026 15:39:24 +0530 Subject: [PATCH 01/15] Update CIs, sync with latest packcheck --- .github/workflows/haskell.yml | 555 +++++++++++++++++++++++++++++----- appveyor.yml | 77 +++-- 2 files changed, 508 insertions(+), 124 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index ae5d6e9..04a1adc 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -1,118 +1,509 @@ -name: Haskell CI +# packcheck-0.7.1 +# You can use any of the options supported by packcheck as environment +# variables here. See https://github.com/composewell/packcheck for all +# options and their explanation. + +name: TEST + +#----------------------------------------------------------------------------- +# Events on which the build should be triggered +#----------------------------------------------------------------------------- on: + workflow_dispatch: + pull_request: push: branches: - master - pull_request: + +#----------------------------------------------------------------------------- +# Build matrix +#----------------------------------------------------------------------------- jobs: build: - name: GHC ${{ matrix.name }} + name: >- + ${{ matrix.runner }} + ${{ matrix.command }} + ${{ matrix.ghc_version }} + ${{ matrix.name }} env: - CABAL_REINIT_CONFIG: y - LC_ALL: C.UTF-8 + # ------------------------------------------------------------------------ + # What to build + # ------------------------------------------------------------------------ + # DISABLE_TEST: "y" + # DISABLE_BENCH: "y" + # DISABLE_DOCS: "y" + # DISABLE_SDIST_BUILD: "y" + # DISABLE_SDIST_GIT_CHECK: "y" + # DISABLE_DIST_CHECKS: "y" + + # ------------------------------------------------------------------------ + # Selecting tool versions + # ------------------------------------------------------------------------ + # For updating see: https://downloads.haskell.org/~ghcup/ + #GHCUP_VERSION: 0.1.50.2 + + # ------------------------------------------------------------------------ + # cabal options + # ------------------------------------------------------------------------ + + # CABAL_BUILD_OPTIONS="-j1" + # Enable the above option if you: + # 1. want logs in serial order to be able to correlate them better. + # + # 2. run into memory issues due to Build paralellism. We need to + # have sufficient per CPU memory, if not we can use a lower -j + # option; cabal default is ncpus. + # + # Currently (2026-03-12) from packcheck output we see: + # Linux: 15GB, 4 cpus + # macOS: 7GB, 3 cpus + # Windows: 16GB, 4 cpus + + # ------------------------------------------------------------------------ + # stack options (if using stack builds) + # ------------------------------------------------------------------------ + # Note requiring a specific version of stack using STACKVER may fail due to + # github API limit while checking and upgrading/downgrading to the specific + # version. + #STACKVER: "1.6.5" + #STACK_UPGRADE: "y" + + # ------------------------------------------------------------------------ + # Common options + # ------------------------------------------------------------------------ + + # Subdir + SUBDIR: ${{ matrix.subdir }} - STACK_UPGRADE: "y" + # If this option is enabled packcheck clears out the environment + # and only uses the options explicitly set on the command line, + # implicit environment won't affect the build. if you find this + # annoying comment this. + CHECK_ENV: "y" - CABAL_CHECK_RELAX: y + # NOTE: by capturing the options in env variables here quotes + # are presrved, if we expand them directly into the script + # quotes are lost. + # + # WARNING! you cannot use comments in this + COMMON_OPTIONS: >- + LC_ALL=C.UTF-8 + BUILD_PREFETCH=y + GHCUP_VERSION=latest + GHCVER=${{ matrix.ghc_version }} - PACKCHECK: "./packcheck.sh" + # WARNING! you cannot use comments in this + CABAL_OPTIONS: >- + CABAL_REINIT_CONFIG=y + CABAL_CHECK_RELAX=y + DISABLE_DOCS="y" + DISABLE_TEST="y" + DISABLE_BENCH="y" + + MATRIX_OPTIONS: ${{ matrix.pack_options }} + + # ------------------------------------------------------------------------ + # Location of packcheck.sh (the shell script invoked to perform CI tests ). + # ------------------------------------------------------------------------ + # You can either commit the packcheck.sh script in your repo root or + # you can use it by specifying the PACKCHECK_REPO_URL option. + # If you have not committed packcheck.sh in your repo at PACKCHECK + # then it is automatically pulled from this URL. PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" - PACKCHECK_GITHUB_COMMIT: "101c73b53473ddfb763d65058b80123991cfeb4f" - - BUILD: ${{ matrix.build }} - GHCUP_VERSION: 0.1.20.0 - GHCVER: ${{ matrix.ghc_version }} - CABALVER: ${{ matrix.cabal_version }} - CABAL_BUILD_OPTIONS: ${{ matrix.cabal_build_options }} - CABAL_PROJECT: ${{ matrix.cabal_project }} - DISABLE_DOCS: "y" - DISABLE_TEST: "y" - DISABLE_BENCH: "y" - DISABLE_SDIST_BUILD: ${{ matrix.disable_sdist_build }} + PACKCHECK_GITHUB_COMMIT: "3f0f1d1dd8252a8e8b5256bc86428b46039d8dba" + # ubuntu seems to have better support than debian on CI systems runs-on: ${{ matrix.runner }} + #continue-on-error: ${{ matrix.ignore_error }} strategy: fail-fast: false matrix: + + # The order of jobs is important to optimize fail-fast, if + # fail-fast is set to true. + + # This section is to order the important jobs first especially for + # "fail-fast" so that these are the ones started first. + #name: + # - ci + + # IMPORTANT NOTE: + # If runner, command, ghc version are identical then the name of + # CI is used to distinguish the cache key. + + # The reason we have an explicit "name" field in the following + # entries is to force an additional config instead of adding to + # an existing config while adding additional configs. + # Look at + # for more info about adding matrix elements. + # Adding any element to the list will increase the number of matrix + # elements proportional to the cross product. + include: - - name: 9.8.1 - ghc_version: 9.8.1 + + #- name: ci + # runner: ubuntu-latest + # command: cabal + # ghc_version: head + # # The URL may change, to find a working URL go to https://gitlab.haskell.org/ghc/ghc/-/jobs/ + # # Find a debian10/11/12 job, click on a passed/failed status, at the + # # end of the output you will find the tar.xz name, put that tar + # # name after "raw/", and put the job name after "job=". + # # Also see https://github.com/mpickering/ghc-artefact-nix/blob/master/gitlab-artifact.nix + # # + # # May also use ghcup for installing ghc head version, use the + # # version "LatestNightly", and the following config: + # # ghcup config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml + # # WARNING! cannot use # comments inside pack_options. + # pack_options: >- + # GHCUP_GHC_OPTIONS="-u https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-linux-deb10-int_native-validate.tar.xz?job=x86_64-linux-deb10-int_native-validate" + # CABAL_PROJECT=cabal.project.ghc-head + # DISABLE_SDIST_BUILD="y" + + - name: ci runner: ubuntu-latest - build: cabal - cabal_project: cabal.project.user - cabal_version: 3.10.1.0 - disable_sdist_build: "y" - ignore_error: false - - name: 9.6.3-macos - ghc_version: 9.6.3 + command: cabal + ghc_version: 9.14.1 + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + CABAL_PROJECT=cabal.project.user + + - name: ci runner: macos-latest - build: cabal - cabal_project: cabal.project.user - disable_sdist_build: "y" - cabal_version: 3.10.1.0 - cabal_build_options: "--flag interop" - ignore_error: false - - name: 9.4.4 - ghc_version: 9.4.4 + command: cabal + ghc_version: 9.12.4 + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + CABAL_PROJECT=cabal.project.user + + - name: interop + runner: ubuntu-latest + command: cabal + ghc_version: 9.10.3 + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + CABAL_PROJECT=cabal.project.user + CABAL_BUILD_OPTIONS="--flag interop" + + - name: ghc-9.10.3 + runner: ubuntu-latest + command: stack + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + STACK_UPGRADE="y" + STACK_YAML="stack.yaml" + DISABLE_SDIST_BUILD="y" + + - name: ci runner: ubuntu-latest - build: cabal - cabal_project: cabal.project.user - cabal_version: 3.8.1.0 - disable_sdist_build: "y" - ignore_error: false - - name: 9.2.7 - ghc_version: 9.2.7 + command: cabal + ghc_version: 9.8.4 + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + CABAL_PROJECT=cabal.project.user + + - name: ci runner: ubuntu-latest - build: cabal - cabal_project: cabal.project.user - cabal_version: 3.6.2.0 - disable_sdist_build: "y" - ignore_error: false - - name: 8.10.7 # There is some llvm versioning issue in 8.10.7 and the - # mac machine - ghc_version: 8.10.7 + command: cabal + ghc_version: 9.6.3 + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + CABAL_PROJECT=cabal.project.user + + - name: ci + runner: windows-latest + command: cabal + ghc_version: 9.14.1 + # WARNING! cannot use # comments inside pack_options. + # DISABLE_SDIST_BUILD for shorter paths on Windows + pack_options: >- + DISABLE_SDIST_BUILD="y" + CABAL_PROJECT=cabal.project.user + + - name: ci runner: ubuntu-latest - build: cabal - cabal_project: cabal.project.user - disable_sdist_build: "y" - cabal_version: 3.6.2.0 - ignore_error: false + command: hlint + # WARNING! cannot use # comments inside pack_options. + pack_options: >- + HLINT_VERSION=3.6.1 + HLINT_OPTIONS="lint" + HLINT_TARGETS="src" + + #- name: docspec + # runner: ubuntu-latest + # command: cabal + # ghc_version: 9.12.4 + # # WARNING! cannot use # comments inside pack_options. + # pack_options: >- + # ENABLE_DOCSPEC="y" + # DOCSPEC_URL=https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20250606/cabal-docspec-0.0.0.20250606-x86_64-linux.xz + # DOCSPEC_OPTIONS="--timeout 60" + # CABAL_PROJECT=cabal.project + +#----------------------------------------------------------------------------- +# Usually you do not need to change anything below, this is generic code for +# caching and running packcheck on Linux/Mac/Windows. +#----------------------------------------------------------------------------- + steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v4 - name: Cache common directories + + - name: Enable long paths on Windows + if: runner.os == 'Windows' + shell: powershell + continue-on-error: true + run: | + # Enable long paths. Sometimes failures occur due to path + # length limitation. + Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1 + + # Cache saving is very slow on Windows, it could be due to tar, + # or the compression program or the file system. Changing the + # compression level of zstd does not help. We are also not able to pick + # another tar program by changing the path, tar is picked up by the + # cache action itself. + + # This does not seem to make much difference. + # Disable Windows Defender to speed up IO/Tar operations + #Set-MpPreference -DisableRealtimeMonitoring $true + + - uses: actions/checkout@v4 + + # This should happen before cache restore. + - name: Remove ~/.ghcup symlink (non-Windows) + if: runner.os != 'Windows' + run: | + rm -f ~/.ghcup + + # See the "cabal path" output in the CI logs to tweak the cache + # locations. + + # Shared by all tests, all platforms + - name: Restore hackage package index (non-Windows) + id: restore-hackage + uses: actions/cache/restore@v4 + if: runner.os != 'Windows' + with: + path: | + ~/.cache/cabal/packages + key: cabal-hackage-index-non-windows + + # GHC is not test/options specific + - name: Restore ghcup and ghc (non-Windows) + id: restore-ghcup + uses: actions/cache/restore@v4 + if: runner.os != 'Windows' with: path: | - ~/.cabal - ~/.ghc - ~/.local - ~/.stack ~/.ghcup - key: ${{ runner.os }}-${{ matrix.ghc_version }}-cabal + key: ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }} + + # GHC is not test/options specific + #- name: Restore ghcup and ghc (Windows) + # id: restore-ghcup-win + # uses: actions/cache/restore@v4 + # if: runner.os == 'Windows' + # with: + # path: | + # C:/ghcup + # key: ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }} + + # XXX If we want to invalidate the cache on resolver change we + # should use a separate cache for stack as it should be keyed on + # resolver as well. But that requires resolver as a matrix element + # and then copied to pack_options from there, needs some work. It + # should be fine as resolver minor version change can only increase + # the cache size. + # Deps are test/options specific + - name: Restore build dependencies (non-Windows) + id: restore-deps-nonwin + uses: actions/cache/restore@v4 + if: runner.os != 'Windows' + with: + # cabal: ~/.local/bin, ~/.local/state/cabal + # ~/.cache/cabal/packages can be cached, but will increase the + # cache size. But can save the "cabal update" time. + path: | + ~/.local/bin + ~/.local/state/cabal + ~/.stack + key: ${{ matrix.command }}-deps-ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }}-${{ matrix.name }} + + # Deps are test/options specific + - name: Restore build dependencies, hackage index, local/bin (Windows) + id: restore-deps-win + uses: actions/cache/restore@v4 + if: runner.os == 'Windows' + with: + path: | + C:/cabal + key: ${{ matrix.command }}-deps-ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }}-${{ matrix.name }} - name: Download packcheck + # on windows-latest GitHub Actions defaults to PowerShell + shell: bash run: | - # If a custom stack-yaml is specified, replace the default with that - #if test -e "$STACK_YAML"; then rm -f stack.yaml && ln -sv $STACK_YAML stack.yaml; else true; fi - #unset STACK_YAML - - if test ! -e "$PACKCHECK" - then - if test -z "$PACKCHECK_GITHUB_COMMIT" + download_one () { + if test ! -e "$1" then - die "PACKCHECK_GITHUB_COMMIT is not specified." + if test -z "$PACKCHECK_GITHUB_COMMIT" + then + die "Downloading [$1]: PACKCHECK_GITHUB_COMMIT env var is not specified." + fi + PACKCHECK_URL_PREFIX=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT} + curl --fail -sLO ${PACKCHECK_URL_PREFIX}/$1 || exit 1 + chmod +x "$1" + elif test ! -x "$1" + then + chmod +x $1 + fi + } + if test -n "$SUBDIR"; then + cd "$SUBDIR" + fi + download_one packcheck.sh + + # Store the function in a file so that it can be reused across multiple + # steps. + - name: Setup packcheck + shell: bash + run: | + if test -n "$SUBDIR"; then + rm -f cabal.project + cd "$SUBDIR" + fi + cat << 'EOF' > packcheck-setup.sh + setup_packcheck_args() { + ARGS="${{ matrix.command }} $COMMON_OPTIONS" + if test "${{ matrix.command }}" = "cabal"; then + ARGS="$ARGS $CABAL_OPTIONS" fi - CURL=$(which curl) - PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh - $CURL -sL -o "$PACKCHECK" $PACKCHECK_URL - chmod +x $PACKCHECK - elif test ! -x "$PACKCHECK" - then - chmod +x $PACKCHECK + + # Caution: do not use matrix.pack_options directly here + # quotes will get stripped. + ARGS="$ARGS $MATRIX_OPTIONS" + PATH_VAR=/bin:/usr/bin:/sbin:/usr/sbin + + case "$(uname)" in + Linux) + export GHCUP_INSTALL_BASE_PREFIX=$HOME + # Access usr/local seems to be much slower on github + #PATH_VAR="$PATH_VAR:/usr/local/.ghcup/bin" + ;; + CYGWIN*|MINGW*|MSYS*) + for var in APPDATA CABAL_DIR; do + val="${!var}" + [ -n "$val" ] && ARGS="$ARGS $var=\"$(cygpath -u "$val")\"" + done + ARGS="$ARGS CABAL_BUILDDIR=\"/c/b\" WINVER=$WINVER" + ARGS="$ARGS NUMBER_OF_PROCESSORS=$NUMBER_OF_PROCESSORS" + ARGS="$ARGS PROCESSOR_IDENTIFIER=\"$PROCESSOR_IDENTIFIER\"" + PATH_VAR="$PATH_VAR:/c/ghcup:/c/Program Files/7-Zip:/mingw64/bin" + ;; + esac + ARGS="$ARGS PATH=\"$PATH_VAR\"" + export ARGS + } + EOF + + - name: Run packcheck (dependencies only) + id: deps-only + # Check the relevant step based on the runner OS + if: | + (runner.os != 'Windows' && steps.restore-deps-nonwin.outputs.cache-hit != 'true') || + (runner.os == 'Windows' && steps.restore-deps-win.outputs.cache-hit != 'true') + shell: bash + run: | + if test -n "$SUBDIR"; then + cd "$SUBDIR" fi + source packcheck-setup.sh + setup_packcheck_args + eval "./packcheck.sh $ARGS BUILD_DEPS_ONLY=y" + + - name: Save hackage package index (non-Windows) + uses: actions/cache/save@v4 + if: always() && steps.deps-only.outcome == 'success' && runner.os != 'Windows' && steps.restore-hackage.outputs.cache-hit != 'true' + with: + path: ~/.cache/cabal/packages + key: cabal-hackage-index-non-windows + + - name: Save ghcup and ghc (non-Windows) + uses: actions/cache/save@v4 + if: always() && steps.deps-only.outcome == 'success' && runner.os != 'Windows' && steps.restore-ghcup.outputs.cache-hit != 'true' + with: + path: ~/.ghcup + key: ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }} + + # On Windows, ghc restore step takes 2-3 minutes whereas installing + # GHC takes less than 2 minutes. On top of this saving the ghc cache + # takes 7 minutes. So this does not make sense. + #- name: Save ghcup and ghc (Windows) + # uses: actions/cache/save@v4 + # if: always() && steps.deps-only.outcome == 'success' && runner.os == 'Windows' && steps.restore-ghcup-win.outputs.cache-hit != 'true' + # with: + # path: | + # C:/ghcup + # key: ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }} - - name: Run packcheck + # Deps are test/options specific, hence, matrix.name in the key + - name: Save build dependencies (non-Windows) + uses: actions/cache/save@v4 + if: always() && steps.deps-only.outcome == 'success' && runner.os != 'Windows' && steps.restore-deps-nonwin.outputs.cache-hit != 'true' + with: + path: | + ~/.local/bin + ~/.local/state/cabal + ~/.stack + key: ${{ matrix.command }}-deps-ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }}-${{ matrix.name }} + + # hackage package index is part of C:/cabal + # Deps are test/options specific, hence, matrix.name in the key + # Add if needed ~/AppData/Roaming/local + - name: Save build dependencies (Windows) + uses: actions/cache/save@v4 + if: always() && steps.deps-only.outcome == 'success' && runner.os == 'Windows' && steps.restore-deps-win.outputs.cache-hit != 'true' + with: + path: | + C:/cabal + key: ${{ matrix.command }}-deps-ghc-${{ matrix.ghc_version }}-v${{ matrix.ghc_salt }}-${{ matrix.runner }}-${{ matrix.name }} + + - name: Run packcheck (final build) + shell: bash run: | - bash -c "$PACKCHECK $BUILD" + if test -n "$SUBDIR"; then + cd "$SUBDIR" + fi + source packcheck-setup.sh + setup_packcheck_args + eval "./packcheck.sh $ARGS BUILD_PACKAGE_ONLY=y" + + # Enable for debugging, this itself takes 50 sec on Windows, in packcheck + # build which is tiny. + #- name: Check cache locations + # shell: bash + # run: | + # # We want to see if any cache paths are symlinks; e.g. on github + # # ~/.ghcup is a pre-existing symlink to /usr/local. + # if [ "$RUNNER_OS" == "Windows" ]; then + # # Convert Windows paths to Unix-style for Bash + # APPDATA_UNIX=$(cygpath "$APPDATA") + # list="$APPDATA_UNIX/local C:/ghcup C:/cabal" + # else + # list="$HOME/.local/bin $HOME/.local/state/cabal $HOME/.ghcup $HOME/.stack" + # fi + + # for dir in $list; do + # # macOS does not have --no-dereference option + # if [ -L "$dir" ]; then + # echo "$dir is a symlink -> $(readlink $dir)" + # elif [ -d "$dir" ]; then + # du -sh "$dir" 2>/dev/null || echo "$dir permission denied" + # else + # echo "$dir missing or not a dir" + # fi + # done + # echo + # #ls -ld $list 2>/dev/null || true + # ls -al $list 2>/dev/null || true diff --git a/appveyor.yml b/appveyor.yml index 2316066..b71f4a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,11 @@ -# packcheck-0.4.2 +# packcheck-0.7.1 # You can use any of the options supported by packcheck as environment -# variables here. See https://github.com/harendra-kumar/packcheck for all +# variables here. See https://github.com/composewell/packcheck for all # options and their explanation. -branches: - only: - - master + +#branches: +# only: +# - master environment: # ------------------------------------------------------------------------ @@ -14,44 +15,34 @@ environment: # ------------------------------------------------------------------------ # Common options # ------------------------------------------------------------------------ - GHC_OPTIONS: "-Werror" CABAL_REINIT_CONFIG: "y" LC_ALL: "C.UTF-8" + # ------------------------------------------------------------------------ + # How to build + # ------------------------------------------------------------------------ + # + GHCUP_VERSION: "0.1.50.2" + GHCVER: "9.14.1" + #CABALVER: "3.10.3.0" + # ------------------------------------------------------------------------ # What to build # ------------------------------------------------------------------------ # DISABLE_TEST: "y" # DISABLE_BENCH: "y" # DISABLE_DOCS: "y" - DISABLE_SDIST_BUILD: "y" - DISABLE_DIST_CHECKS: "y" - ENABLE_INSTALL: "y" - - # ------------------------------------------------------------------------ - # stack options - # ------------------------------------------------------------------------ - # Note requiring a specific version of stack using STACKVER may fail due to - # github API limit while checking and upgrading/downgrading to the specific - # version. - #STACKVER: "1.6.5" - STACK_UPGRADE: "y" - RESOLVER: "nightly-2023-12-14" - STACK_ROOT: "c:\\sr" - STACK_YAML: "stack.yaml" + # DISABLE_DIST_CHECKS: "y" + # DISABLE_SDIST_BUILD: "y" + # Note: these require the "diff" utility. + # DISABLE_SDIST_GIT_CHECK: "y" + DISABLE_SDIST_PROJECT_CHECK: "y" # ------------------------------------------------------------------------ # cabal options # ------------------------------------------------------------------------ - CABAL_BUILD_OPTIONS: "--flag interop" CABAL_CHECK_RELAX: "y" - CABAL_NO_SANDBOX: "y" - - # ------------------------------------------------------------------------ - # Where to find the required tools - # ------------------------------------------------------------------------ - PATH: "%PATH%;%APPDATA%\\local\\bin" - LOCAL_BIN: "%APPDATA%\\local\\bin" + CABAL_PROJECT: "cabal.project.user" # ------------------------------------------------------------------------ # Location of packcheck.sh (the shell script invoked to perform CI tests ). @@ -63,32 +54,34 @@ environment: PACKCHECK_LOCAL_PATH: "./packcheck.sh" # If you have not committed packcheck.sh in your repo at PACKCHECK_LOCAL_PATH # then it is automatically pulled from this URL. - PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/harendra-kumar/packcheck" - PACKCHECK_GITHUB_COMMIT: "101c73b53473ddfb763d65058b80123991cfeb4f" + PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" + PACKCHECK_GITHUB_COMMIT: "3f0f1d1dd8252a8e8b5256bc86428b46039d8dba" # Override the temp directory to avoid sed escaping issues # See https://github.com/haskell/cabal/issues/5386 TMP: "c:\\tmp" +# Bump the -> version to clear the cache +# packcheck uses "%APPDATA%\\local" to install tools like hlint etc. +# cabal may use "%APPDATA%\\cabal" or "c:\\cabal" +# ghcup may use "%APPDATA%\\ghcup" or "c:\\ghcup" cache: - - "%STACK_ROOT%" - - "%LOCAL_BIN%" + - "%APPDATA%\\local\\bin -> v1" - "%APPDATA%\\cabal" - - "%APPDATA%\\ghc" -# - "%LOCALAPPDATA%\\Programs\\stack" + - "%LOCALAPPDATA%\\cabal" + - "C:\\ghcup" + - "C:\\cabal" +# Folder where the repository is cloned. clone_folder: "c:\\pkg" build: off before_test: -- if not exist %PACKCHECK_LOCAL_PATH% curl -sSkL -o%PACKCHECK_LOCAL_PATH% %PACKCHECK_GITHUB_URL%/%PACKCHECK_GITHUB_COMMIT%/packcheck.sh -- if not exist %LOCAL_BIN% mkdir %LOCAL_BIN% -- where stack.exe || curl -sSkL -ostack.zip http://www.stackage.org/stack/windows-x86_64 && 7z x stack.zip stack.exe && move stack.exe %LOCAL_BIN% -- if defined STACKVER (stack upgrade --binary-only --binary-version %STACKVER%) else (stack upgrade --binary-only || ver > nul) -- stack --version +- if not exist %PACKCHECK_LOCAL_PATH% curl --fail -sSL -o%PACKCHECK_LOCAL_PATH% %PACKCHECK_GITHUB_URL%/%PACKCHECK_GITHUB_COMMIT%/packcheck.sh test_script: -- stack setup > nul - for /f "usebackq tokens=*" %%i in (`where 7z.exe`) do set PATH7Z=%%i\.. - for /f "usebackq tokens=*" %%i in (`where git.exe`) do set PATHGIT=%%i\.. -- chcp 65001 && stack exec bash -- -c "chmod +x %PACKCHECK_LOCAL_PATH%; %PACKCHECK_LOCAL_PATH% stack PATH=/usr/bin:\"%PATH7Z%\":\"%PATHGIT%\"" +- for /f "usebackq tokens=*" %%i in (`where curl.exe`) do set PATHCURL=%%i\.. +- chcp 65001 +- bash %PACKCHECK_LOCAL_PATH% cabal PATH="/usr/bin:%PATH7Z%:%PATHGIT%:%PATHCURL%" From 326d3a974c3601c1bdc368903f7441f8f34f8db1 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 15 Apr 2026 16:29:43 +0530 Subject: [PATCH 02/15] Remove circleci --- .circleci/config.yml | 264 ------------------------------------------- 1 file changed, 264 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 815ef7e..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,264 +0,0 @@ -version: 2.1 - -#----------------------------------------------------------------------------- -# packcheck-0.7.0 -# Packcheck global environment variables -#----------------------------------------------------------------------------- - -env: &env - environment: - # ------------------------------------------------------------------------ - # Common options - # ------------------------------------------------------------------------ - # GHC_OPTIONS: "-Werror" - GHCUP_VERSION: 0.1.20.0 - CABAL_REINIT_CONFIG: "y" - LC_ALL: "C.UTF-8" - - # ------------------------------------------------------------------------ - # What to build - # ------------------------------------------------------------------------ - DISABLE_TEST: "y" - DISABLE_BENCH: "y" - DISABLE_DOCS: "y" - DISABLE_SDIST_BUILD: "yes" - DISABLE_DIST_CHECKS: "yes" - - # ------------------------------------------------------------------------ - # stack options - # ------------------------------------------------------------------------ - # Note requiring a specific version of stack using STACKVER may fail due to - # github API limit while checking and upgrading/downgrading to the specific - # version. - #STACKVER: "1.6.5" - STACK_UPGRADE: "y" - #RESOLVER: "lts-12" - - # ------------------------------------------------------------------------ - # cabal options - # ------------------------------------------------------------------------ - CABAL_CHECK_RELAX: "y" - CABAL_NO_SANDBOX: "y" - - # ------------------------------------------------------------------------ - # Where to find the required tools - # ------------------------------------------------------------------------ - PATH: /sbin:/usr/sbin:/bin:/usr/bin - #TOOLS_DIR: /opt - - # ------------------------------------------------------------------------ - # Location of packcheck.sh (the shell script invoked to perform CI tests ). - # ------------------------------------------------------------------------ - # You can either commit the packcheck.sh script at this path in your repo or - # you can use it by specifying the PACKCHECK_REPO_URL option below in which - # case it will be automatically copied from the packcheck repo to this path - # during CI tests. In any case it is finally invoked from this path. - PACKCHECK: "./packcheck.sh" - # If you have not committed packcheck.sh in your repo at PACKCHECK - # then it is automatically pulled from this URL. - PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" - PACKCHECK_GITHUB_COMMIT: "101c73b53473ddfb763d65058b80123991cfeb4f" - -# image is a tag from docker registery -executors: - amd64-executor: - docker: - - image: ubuntu:latest - x86-executor: - docker: - - image: i386/ubuntu:eoan - -#----------------------------------------------------------------------------- -# Common utility stuff, not to be modified usually -#----------------------------------------------------------------------------- - -preinstall: &preinstall - run: | - export DEBIAN_FRONTEND=noninteractive - apt-get update - # For sdl build flag - apt-get install -y libsdl2-dev - - # required for https/cache save and restore - apt-get install -y ca-certificates - - # NOTE: depends on specific debian version in the deb line below - # For ghc and cabal-install packages from haskell.org - # gnupg is required for apt-key to work - #apt-get install -y gnupg - #apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 - #echo "deb http://downloads.haskell.org/debian buster main" >> /etc/apt/sources.list - #apt-get update - - # required for outbound https for stack and for stack setup - apt-get install -y netbase xz-utils make - apt-get install -y zlib1g-dev - - # For ghcup to install ghc - if test -n "$GHCUP_VERSION" - then - apt-get install -y gcc - apt-get install -y g++ - fi - - # libgmp required by ghc for linking - apt-get install -y libgmp-dev - apt-get install -y libtinfo-dev - - # Required by cabal when git URL is specified in project file - apt-get install -y git - - # Required for and by packcheck - apt-get install -y curl - - # Get packcheck if needed - if test ! -e "$PACKCHECK" - then - if test -z "$PACKCHECK_GITHUB_COMMIT" - then - die "PACKCHECK_GITHUB_COMMIT is not specified." - fi - CURL=$(which curl) - PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh - $CURL -sL -o "$PACKCHECK" $PACKCHECK_URL - chmod +x $PACKCHECK - elif test ! -x "$PACKCHECK" - then - chmod +x $PACKCHECK - fi - -restore: &restore - # Needs to happen after installing ca-certificates - restore_cache: - key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }} - -save: &save - save_cache: - key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }} - paths: - - ~/.cabal - - ~/.ghc - - ~/.local - - ~/.stack - - ~/.ghcup - -#----------------------------------------------------------------------------- -# Build matrix -#----------------------------------------------------------------------------- - -jobs: - cabal-ghc-9_8_1_Werror: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: GHC 9.8.1 + fusion-plugin + Werror - environment: - CABAL_PROJECT: "cabal.project.ci" - CABAL_BUILD_OPTIONS: "--flag fusion-plugin" - CABALVER: "3.10.2.0" - GHCVER: "9.8.1" - command: | - bash -c "$PACKCHECK cabal" - - *save - cabal-ghc-9_6_3_all_flags: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: GHC 9.6.3 + sdl2 + interop + fusion-plugin - environment: - CABAL_PROJECT: "cabal.project.user" - CABAL_BUILD_OPTIONS: "--flag sdl2 --flag interop --flag fusion-plugin" - CABALVER: "3.10.2.0" - GHCVER: "9.6.3" - command: | - bash -c "$PACKCHECK cabal" - - *save -# Fails with this error: -# withBinaryFile: invalid argument (Symbolic link loop) - stack-ghc-9_6_3: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: stack nightly-2023-12-14 - environment: - RESOLVER: "nightly-2023-12-14" - STACK_YAML: "stack.yaml" - DISABLE_SDIST_BUILD: "y" - #SDIST_OPTIONS: "--ignore-check" - command: | - bash -c "$PACKCHECK stack" - - *save - cabal-ghc-9_0_1_sdist: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: GHC 9.0.1 + sdist + fusion-plugin - environment: - CABAL_PROJECT: "cabal.project.user" - CABAL_BUILD_OPTIONS: "--flag fusion-plugin" - DISABLE_SDIST_BUILD: "no" - CABALVER: "3.10.2.0" - GHCVER: "9.0.1" - command: | - bash -c "$PACKCHECK cabal" - - *save - cabal-ghc-8_6_5: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: GHC 8.6.5 - environment: - CABAL_PROJECT: "cabal.project.user" - CABALVER: "3.10.2.0" - GHCVER: "8.6.5" - command: | - bash -c "$PACKCHECK cabal" - #no_output_timeout: 25m - - *save - hlint: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: Hlint examples - environment: - HLINT_VERSION: 3.6.1 - HLINT_OPTIONS: lint - HLINT_TARGETS: examples - command: | - bash -c "$PACKCHECK hlint" - - *save - -workflows: - version: 2 - build: - jobs: - - cabal-ghc-9_8_1_Werror - - cabal-ghc-9_6_3_all_flags - - stack-ghc-9_6_3 - - cabal-ghc-9_0_1_sdist - - cabal-ghc-8_6_5 - - hlint From 69cf571ddf9e23243efdf1945aa316766d159006 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 15 Apr 2026 16:31:13 +0530 Subject: [PATCH 03/15] Bump upper bounds of some deps --- streamly-examples.cabal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/streamly-examples.cabal b/streamly-examples.cabal index 813c80d..d76cecc 100644 --- a/streamly-examples.cabal +++ b/streamly-examples.cabal @@ -68,10 +68,10 @@ common exe-dependencies -- , streamly-fsevents == 0.1.0 , streamly-core == 0.3.0 , streamly-fsevents == 0.1.0 - , base >= 4.9 && < 4.22 + , base >= 4.9 && < 4.23 , directory >= 1.2 && < 1.4 , transformers >= 0.4 && < 0.7 - , containers >= 0.5 && < 0.8 + , containers >= 0.5 && < 0.9 , random >= 1.0.0 && < 2 , exceptions >= 0.8 && < 0.11 , transformers-base >= 0.4 && < 0.5 @@ -366,7 +366,7 @@ executable DateTimeParser main-is: DateTimeParser.hs if !impl(ghcjs) buildable: True - build-depends: tasty-bench >= 0.3 && < 0.5 + build-depends: tasty-bench >= 0.3 && < 0.6 else buildable: False @@ -375,6 +375,6 @@ executable LogParser main-is: LogParser.hs if !impl(ghcjs) buildable: True - build-depends: tasty-bench >= 0.3 && < 0.5 + build-depends: tasty-bench >= 0.3 && < 0.6 else buildable: False From c126a014dcf1b14427ce075463d5a13d5f891b60 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 15 Apr 2026 17:02:49 +0530 Subject: [PATCH 04/15] Use only hackage packages --- .github/workflows/haskell.yml | 2 +- .packcheck.ignore | 2 -- cabal.project.Werror | 30 +++++++++++++++--------------- cabal.project.ci | 20 -------------------- cabal.project.user | 30 +++++++++++++++--------------- 5 files changed, 31 insertions(+), 53 deletions(-) delete mode 100644 cabal.project.ci diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 04a1adc..f64bd03 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -184,7 +184,7 @@ jobs: ghc_version: 9.10.3 # WARNING! cannot use # comments inside pack_options. pack_options: >- - CABAL_PROJECT=cabal.project.user + CABAL_PROJECT=cabal.project.Werror CABAL_BUILD_OPTIONS="--flag interop" - name: ghc-9.10.3 diff --git a/.packcheck.ignore b/.packcheck.ignore index 54efaea..f2277ff 100644 --- a/.packcheck.ignore +++ b/.packcheck.ignore @@ -1,5 +1,4 @@ .packcheck.ignore -.circleci/config.yml .github/workflows/haskell.yml .gitignore .hlint.ignore @@ -8,6 +7,5 @@ examples/SearchQuery.hs hie.yaml stack.yaml cabal.project.user -cabal.project.ci cabal.project.Werror default.nix diff --git a/cabal.project.Werror b/cabal.project.Werror index 1e5f3fc..d654a56 100644 --- a/cabal.project.Werror +++ b/cabal.project.Werror @@ -2,21 +2,21 @@ packages: streamly-examples.cabal jobs: 1 -source-repository-package - type: git - location: https://github.com/composewell/streamly - tag: master - -source-repository-package - type: git - location: https://github.com/composewell/streamly - tag: master - subdir: core - -source-repository-package - type: git - location: https://github.com/composewell/streamly-fsevents - tag: master +-- source-repository-package +-- type: git +-- location: https://github.com/composewell/streamly +-- tag: master +-- +-- source-repository-package +-- type: git +-- location: https://github.com/composewell/streamly +-- tag: master +-- subdir: core +-- +-- source-repository-package +-- type: git +-- location: https://github.com/composewell/streamly-fsevents +-- tag: master package streamly-examples ghc-options: -Werror diff --git a/cabal.project.ci b/cabal.project.ci deleted file mode 100644 index 1d1b409..0000000 --- a/cabal.project.ci +++ /dev/null @@ -1,20 +0,0 @@ -packages: . - -package streamly-examples - ghc-options: -Werror - -source-repository-package - type: git - location: https://github.com/composewell/streamly - tag: master - -source-repository-package - type: git - location: https://github.com/composewell/streamly - tag: master - subdir: core - -source-repository-package - type: git - location: https://github.com/composewell/streamly-fsevents - tag: master diff --git a/cabal.project.user b/cabal.project.user index 38fe9e9..0e24786 100644 --- a/cabal.project.user +++ b/cabal.project.user @@ -2,18 +2,18 @@ packages: streamly-examples.cabal jobs: 1 -source-repository-package - type: git - location: https://github.com/composewell/streamly - tag: master - -source-repository-package - type: git - location: https://github.com/composewell/streamly - tag: master - subdir: core - -source-repository-package - type: git - location: https://github.com/composewell/streamly-fsevents - tag: master +-- source-repository-package +-- type: git +-- location: https://github.com/composewell/streamly +-- tag: master +-- +-- source-repository-package +-- type: git +-- location: https://github.com/composewell/streamly +-- tag: master +-- subdir: core +-- +-- source-repository-package +-- type: git +-- location: https://github.com/composewell/streamly-fsevents +-- tag: master From e2789a76241aa98e92dd37fc4876ca37603bc1c2 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 15 Apr 2026 18:48:52 +0530 Subject: [PATCH 05/15] Update tested-with field --- streamly-examples.cabal | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/streamly-examples.cabal b/streamly-examples.cabal index d76cecc..3cf25f9 100644 --- a/streamly-examples.cabal +++ b/streamly-examples.cabal @@ -22,14 +22,21 @@ description: category: Streamly, Streaming, Concurrency, Text, Filesystem, Network, Reactivity stability: provisional -tested-with: GHC==9.4.4, GHC==9.2.7, GHC==9.0.1, GHC==8.10.7 +tested-with: + GHC==9.14.1 + , GHC==9.12.4 + , GHC==9.10.3 + , GHC==9.8.4 + , GHC==9.6.3 build-type: Simple -extra-source-files: - Cargo.toml +extra-doc-files: Changelog.md - Makefile NOTICE README.md + +extra-source-files: + Cargo.toml + Makefile examples/ListDirBasic.c examples/ListDirBasic.rs examples/WalkDirBasic.rs From b9b42f879a558a3cd64a991e0107baf388839009 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Wed, 15 Apr 2026 23:45:30 +0530 Subject: [PATCH 06/15] Update streamly-fsevents bounds --- streamly-examples.cabal | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/streamly-examples.cabal b/streamly-examples.cabal index 3cf25f9..bf39318 100644 --- a/streamly-examples.cabal +++ b/streamly-examples.cabal @@ -72,9 +72,8 @@ flag interop common exe-dependencies build-depends: streamly == 0.11.0 - -- , streamly-fsevents == 0.1.0 , streamly-core == 0.3.0 - , streamly-fsevents == 0.1.0 + , streamly-fsevents >= 0.1.0 && < 0.2 , base >= 4.9 && < 4.23 , directory >= 1.2 && < 1.4 , transformers >= 0.4 && < 0.7 From f49edce87ebbf4bc61c20203c8fa24f1c9136a43 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 02:58:01 +0530 Subject: [PATCH 07/15] Add a flake file based on streamly-packages --- .packcheck.ignore | 5 +- default.nix | 169 ---------------------------------------------- flake.lock | 88 ++++++++++++++++++++++++ flake.nix | 17 +++++ packages.nix | 23 +++++++ sources.nix | 9 +++ 6 files changed, 141 insertions(+), 170 deletions(-) delete mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 packages.nix create mode 100644 sources.nix diff --git a/.packcheck.ignore b/.packcheck.ignore index f2277ff..2c72ea8 100644 --- a/.packcheck.ignore +++ b/.packcheck.ignore @@ -8,4 +8,7 @@ hie.yaml stack.yaml cabal.project.user cabal.project.Werror -default.nix +flake.lock +flake.nix +packages.nix +sources.nix diff --git a/default.nix b/default.nix deleted file mode 100644 index 6595d52..0000000 --- a/default.nix +++ /dev/null @@ -1,169 +0,0 @@ -# CAUTION! a spelling mistake in arg string is ignored silently. -# -# nix-shell --argstr c2nix "--flag examples-sdl" - -# To use ghc-8.6.5 -# nix-shell --argstr compiler "ghc865" - -{ - nixpkgs ? - import - (builtins.fetchTarball - https://github.com/NixOS/nixpkgs/archive/refs/tags/22.05.tar.gz) - {} -, compiler ? "ghc922" -, c2nix ? "" # cabal2nix CLI options -# TODO -#, sources ? [] # e.g. [./. ./benchmark] -#, hdeps ? [] # e.g. [time, mtl] -#, deps ? [] # e.g. [SDL2] -}: -let haskellPackages = - if compiler == "default" - then nixpkgs.haskellPackages - else nixpkgs.haskell.packages.${compiler}; - - # we can possibly avoid adding our package to HaskellPackages like - # in the case of nix-shell for a single package? - mkPackage = super: pkg: path: opts: inShell: - let orig = super.callCabal2nixWithOptions pkg path opts {}; - in if inShell - # Avoid copying the source directory to nix store by using - # src = null. - then orig.overrideAttrs (oldAttrs: { src = null; }) - else orig; - - # sdl2 needs to be updated for ghc922 - # flags = "--flag fusion-plugin --flag sdl2 --flag interop" + " " + c2nix; - flags = "--flag fusion-plugin --flag interop" + " " + c2nix; - - mkHaskellPackages = inShell: - haskellPackages.override { - # We could disbale doCheck on all like this, but it would make the - # whole world rebuild, we can't use the binary cache - #packageSetConfig = self: super: { - # mkDerivation = drv: super.mkDerivation (drv // { - # doCheck = false; - # }); - #}; - overrides = self: super: - with nixpkgs.haskell.lib; - { - streamly-examples = - mkPackage super "streamly-examples" - ./. flags inShell; - - streamly = - nixpkgs.haskell.lib.overrideCabal - #(super.callHackageDirect - # { pkg = "streamly"; - # ver = "0.9.0"; - # sha256 = "sha256-CjFq9SCdbgLZa7NqOE4OtC8OaFg4vK8VmIDjGU5rGko="; - # } {}) - (let src = fetchGit { - url = "git@github.com:composewell/streamly.git"; - rev = "147750cc437388b276e07f69c25ceb4d1229bcc7"; - }; in super.callCabal2nix "streamly" src {}) - (old: - { librarySystemDepends = - if builtins.currentSystem == "x86_64-darwin" - then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa] - else []; - enableLibraryProfiling = false; - doHaddock = false; - }); - - streamly-core = - nixpkgs.haskell.lib.overrideCabal - (let src = fetchGit { - url = "git@github.com:composewell/streamly.git"; - rev = "147750cc437388b276e07f69c25ceb4d1229bcc7"; - }; in super.callCabal2nix "streamly-core" "${src}/core" {}) - (old: - { librarySystemDepends = - if builtins.currentSystem == "x86_64-darwin" - then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa] - else []; - enableLibraryProfiling = false; - doHaddock = false; - }); - - lockfree-queue = - super.callHackageDirect - { pkg = "lockfree-queue"; - ver = "0.2.4"; - sha256 = "1bj9agy3x0yjbscpjgn96gpnj4lvkh39spjvy3jnrr3a42v3ynw7"; - } {}; - - #unicode-data = - # super.callHackageDirect - # { pkg = "unicode-data"; - # ver = "0.3.0"; - # sha256 = "sha256-3R8ZmLoN/oWU0Mr/V4o/90NqiWaE8fprVULgh8/s/Uc="; - # } {}; - - fusion-plugin = - super.callHackageDirect - { pkg = "fusion-plugin"; - ver = "0.2.5"; - sha256 = "sha256-a5ZIi810Utsj0UsQZwnCaRYIJ8RWLUqppg4lYaNvOkM="; - } {}; - - # Example to Use a different version of a package - #QuickCheck = self.QuickCheck_2_14; - - # Example to disable tests if tests fail or take too long - # or to use different configure flags if needed - # - # XXX We need the ability to disable doCheck on all - # those packages that are being built locally and - # not fetched from the cache. Running tests could do - # nasty things to the machine e.g. some tests even - # listen for incoming connections on the network. - #selective = - # super.selective.overrideAttrs (oldAttrs: - # { doCheck = false; - # configureFlags = - # oldAttrs.configureFlags ++ ["--disable-tests"]; - # }); - }; - }; - - hspkgs = mkHaskellPackages true; - - # A fake package to add some additional deps to the shell env - additionalDeps = hspkgs.mkDerivation rec { - version = "0.1"; - pname = "streamly-examples-additional"; - license = "BSD-3-Clause"; - - libraryHaskellDepends = with hspkgs; [ - deque - ]; - setupHaskellDepends = with hspkgs; [ - cabal-doctest - ]; - executableFrameworkDepends = with hspkgs; - # XXX On macOS cabal2nix does not seem to generate a - # dependency on Cocoa framework. - if builtins.currentSystem == "x86_64-darwin" - then [nixpkgs.darwin.apple_sdk.frameworks.Cocoa] - else []; - }; - - shell = hspkgs.shellFor { - packages = p: - [ p.streamly-examples - additionalDeps - ]; - shellHook = '' - export CABAL_DIR="$(pwd)/.cabal.nix" - if test -n "$PS_SHELL" - then - export PS1="$PS_SHELL\[$bldred\](nix)\[$txtrst\] " - fi - ''; - }; -in if nixpkgs.lib.inNixShell - then shell - else (mkHaskellPackages false).streamly-examples diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c4e9c98 --- /dev/null +++ b/flake.lock @@ -0,0 +1,88 @@ +{ + "nodes": { + "basepkgs": { + "inputs": { + "basepkgs": "basepkgs_2", + "nixpkgs": "nixpkgs", + "nixpkgs-darwin": "nixpkgs-darwin" + }, + "locked": { + "lastModified": 1776288061, + "narHash": "sha256-Gop8YZeA2m4znMPIhSDSbDEov1VYrIdwmXtb636lhRY=", + "ref": "refs/heads/master", + "rev": "b07df1d7264bc6c03c0388131e9cbdc7f4ae542a", + "revCount": 120, + "type": "git", + "url": "ssh://git@github.com/composewell/streamly-packages" + }, + "original": { + "rev": "b07df1d7264bc6c03c0388131e9cbdc7f4ae542a", + "type": "git", + "url": "ssh://git@github.com/composewell/streamly-packages" + } + }, + "basepkgs_2": { + "locked": { + "lastModified": 1775305167, + "narHash": "sha256-BPBKbDZ9aoGOHDAeScwj/N4h2IHOLLRSJmSC3AXQZko=", + "owner": "composewell", + "repo": "nixpack", + "rev": "fc492c73877aeaa3bf9bec85d0eebc56036d53f9", + "type": "github" + }, + "original": { + "owner": "composewell", + "repo": "nixpack", + "rev": "fc492c73877aeaa3bf9bec85d0eebc56036d53f9", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1774106199, + "narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655", + "type": "github" + } + }, + "nixpkgs-darwin": { + "locked": { + "lastModified": 1774106199, + "narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655", + "type": "github" + } + }, + "root": { + "inputs": { + "basepkgs": "basepkgs", + "nixpkgs": [ + "basepkgs", + "nixpkgs" + ], + "nixpkgs-darwin": [ + "basepkgs", + "nixpkgs-darwin" + ] + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0de53f1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + description = "streamly-examples"; + + inputs = { + basepkgs.url = "git+ssh://git@github.com/composewell/streamly-packages?rev=b07df1d7264bc6c03c0388131e9cbdc7f4ae542a"; + nixpkgs.follows = "basepkgs/nixpkgs"; + nixpkgs-darwin.follows = "basepkgs/nixpkgs-darwin"; + }; + + outputs = { self, nixpkgs, nixpkgs-darwin, basepkgs }: + basepkgs.nixpack.mkOutputs { + inherit nixpkgs nixpkgs-darwin basepkgs; + name = "streamly-examples"; + sources = import ./sources.nix; + packages = import ./packages.nix; + }; +} diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..17a4697 --- /dev/null +++ b/packages.nix @@ -0,0 +1,23 @@ +{ nixpkgs }: +{ +# General packages, haskell or non-haskell will be installed in the +# environment. +packages = + with nixpkgs.pkgs; + [ + ]; + +# Haskell packages available in the nix shell, the dependencies of these +# packages are also installed and exposed in ghc package database. +libraries = +with nixpkgs.haskellPackages; +[ +]; + +# Haskell dev packages. Install only dependencies of these in the shell, +# do not build the packages themselves. +dev-packages = + with nixpkgs.haskellPackages; + [ streamly-examples ]; + +} diff --git a/sources.nix b/sources.nix new file mode 100644 index 0000000..1f89834 --- /dev/null +++ b/sources.nix @@ -0,0 +1,9 @@ +{nixpack}: +with nixpack.mkSources; +{ +layers = [ +{ + streamly-examples = local ./.; +} +]; +} From 7e3df6b18b38cc91b87671c0e72626f80ef90c8e Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 02:58:22 +0530 Subject: [PATCH 08/15] Fix ListDir for Windows --- examples/ListDir.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/ListDir.hs b/examples/ListDir.hs index d02c659..771ae02 100644 --- a/examples/ListDir.hs +++ b/examples/ListDir.hs @@ -28,7 +28,7 @@ import Streamly.Data.Array (Array) import Streamly.Data.Stream (Stream) import Streamly.Data.Unfold (Unfold) import Streamly.FileSystem.DirIO (ReadOptions) -import Streamly.FileSystem.Path (Path) +import Streamly.FileSystem.Path (Path, OsWord) import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering)) import qualified Streamly.Data.Stream.Prelude as Stream @@ -51,16 +51,30 @@ import qualified Streamly.Internal.FileSystem.Path as Path (toArray) #if !defined(mingw32_HOST_OS) && !defined(__MINGW32__) import qualified Streamly.Internal.FileSystem.Posix.ReadDir as Dir (readEitherByteChunks) +#else +import qualified Streamly.Unicode.Stream as Stream #endif {-# INLINE recReadOpts #-} recReadOpts :: ReadOptions -> ReadOptions +{-# INLINE reEncode #-} +reEncode :: Stream IO OsWord -> Stream IO Word8 +#if defined(mingw32_HOST_OS) || defined(__MINGW32__) +recReadOpts = id + +reEncode = + Stream.encodeUtf8 + . Stream.decodeUtf16le +#else recReadOpts = DirIO.followSymlinks True . DirIO.ignoreSymlinkLoops False . DirIO.ignoreMissing True . DirIO.ignoreInaccessible True +reEncode = id +#endif + #if !defined(mingw32_HOST_OS) && !defined(__MINGW32__) -- Fastest implementation, only works for posix as of now. listDirByteChunked :: IO () @@ -111,6 +125,7 @@ listDirByteChunked = do listDirChunked :: IO () listDirChunked = do Stream.fold (Handle.writeWith 32000 stdout) + $ reEncode $ Stream.unfoldEachEndBy 10 Array.reader $ fmap Path.toArray $ Stream.unfoldEach Unfold.fromList @@ -153,6 +168,7 @@ listDirChunked = do listDir :: IO () listDir = do Stream.fold (Handle.writeWith 32000 stdout) + $ reEncode $ Stream.unfoldEachEndBy 10 Array.reader $ fmap (Path.toArray . either id id) From 6a3c06c388071b56e3f08cb7d25ad531bb7578ea Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Sat, 20 Sep 2025 14:07:45 +0530 Subject: [PATCH 09/15] Do not use internal modules in fsevent example --- examples/FileSystemEvent.hs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/examples/FileSystemEvent.hs b/examples/FileSystemEvent.hs index 11f46e9..8c0b924 100644 --- a/examples/FileSystemEvent.hs +++ b/examples/FileSystemEvent.hs @@ -9,16 +9,8 @@ import qualified Data.List.NonEmpty as NonEmpty import qualified Streamly.Data.Fold as Fold import qualified Streamly.Data.Stream as Stream import qualified Streamly.FileSystem.Path as Path - -#if darwin_HOST_OS -import qualified Streamly.Internal.FS.Event.Darwin as Event -#elif linux_HOST_OS -import qualified Streamly.Internal.FS.Event.Linux as Event -#elif mingw32_HOST_OS -import qualified Streamly.Internal.FS.Event.Windows as Event -#else -#error "FS Events not supported on this platform" -#endif +import qualified Streamly.FileSystem.Event as Event +import qualified Streamly.Internal.FS.Event as Event (showEvent) ------------------------------------------------------------------------------- -- Main From 8f6269733d488f08521cb0c9d8a08eaf2231db99 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 03:07:28 +0530 Subject: [PATCH 10/15] Change repo url from "git:" to "https:" --- streamly-examples.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamly-examples.cabal b/streamly-examples.cabal index bf39318..3f2ccb8 100644 --- a/streamly-examples.cabal +++ b/streamly-examples.cabal @@ -44,7 +44,7 @@ extra-source-files: source-repository head type: git - location: git://github.com/composewell/streamly-examples.git + location: https://github.com/composewell/streamly-examples.git ------------------------------------------------------------------------------ -- Flags -- From 7eb38f1639c05072b786f35f85216ef02710277b Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 03:11:31 +0530 Subject: [PATCH 11/15] Update stack resolver --- stack.yaml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/stack.yaml b/stack.yaml index 6dadc01..cead8b4 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,18 +1,17 @@ -resolver: lts-22.43 +resolver: lts-24.37 packages: - '.' extra-deps: -#- streamly-core-0.2.0 -#- streamly-0.10.0 -#- fusion-plugin-0.2.6 -- git: https://github.com/composewell/streamly - commit: c7048326486e537908f9e6b7529f0d783014b7d9 -- git: https://github.com/composewell/streamly - commit: c7048326486e537908f9e6b7529f0d783014b7d9 - subdirs: - - core -- git: https://github.com/composewell/streamly-fsevents - commit: 7c06c187f0437e6857108c89fe74dc7cc53a0bac +- streamly-core-0.3.0 +- streamly-0.11.0 +- streamly-fsevents-0.1.1 + +#- git: https://github.com/composewell/streamly +# commit: 9f256bfa7c441451b46fec02fa0510383643db09 +#- git: https://github.com/composewell/streamly +# commit: 9f256bfa7c441451b46fec02fa0510383643db09 +# subdirs: +# - core rebuild-ghc-options: true From 4b814666d073232e7725d2ff59c2e43c7d0b4727 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 03:20:17 +0530 Subject: [PATCH 12/15] Trigger only one build on appveyor --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b71f4a7..08c094e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,9 +3,9 @@ # variables here. See https://github.com/composewell/packcheck for all # options and their explanation. -#branches: -# only: -# - master +branches: + only: + - master environment: # ------------------------------------------------------------------------ From 8ae7672f666eeb883af71de3ab8df92054680594 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 17:44:07 +0530 Subject: [PATCH 13/15] Bump the package version to 0.3.1 --- Changelog.md | 4 ++++ streamly-examples.cabal | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 85a5e56..3d24720 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## 0.3.1 (Apr 2026) + +* Support GHC 9.14 + ## 0.3.0 (Sep 2025) * Support streamly-0.11.0 and streamly-core-0.3.0 diff --git a/streamly-examples.cabal b/streamly-examples.cabal index 3f2ccb8..2ae4993 100644 --- a/streamly-examples.cabal +++ b/streamly-examples.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: streamly-examples -version: 0.3.0 +version: 0.3.1 license: Apache-2.0 license-file: LICENSE author: Composewell Technologies From 26327a645f48e85612c092547d25f299b90fa115 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 17:55:17 +0530 Subject: [PATCH 14/15] Fix the deprecation warnings in CirclingSquare example --- examples/CirclingSquare.hs | 9 ++++++--- packages.nix | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/CirclingSquare.hs b/examples/CirclingSquare.hs index 0487f2d..f120096 100644 --- a/examples/CirclingSquare.hs +++ b/examples/CirclingSquare.hs @@ -9,7 +9,8 @@ import SDL (($=), V2(..), V4(..), Point(..)) import qualified Data.Text as Text import qualified SDL -import qualified Streamly.Prelude as Stream +import qualified Streamly.Data.Stream as Stream +import qualified Streamly.Data.Fold as Fold ------------------------------------------------------------------------------ -- SDL Graphics Init @@ -79,8 +80,10 @@ main = do _ <- forkIO $ do Stream.repeatM (updateDisplay ref rend) -- Stream IO () & Stream.delay (1/60) -- Stream IO () - & Stream.drain -- IO () + & Stream.fold Fold.drain -- IO () -- MacOS requires pollEvents to run in the Main thread. - Stream.repeatM (handleEvents ref) & Stream.drainWhile (== True) + Stream.repeatM (handleEvents ref) + & Stream.takeWhile (== True) + & Stream.fold Fold.drain SDL.destroyWindow window diff --git a/packages.nix b/packages.nix index 17a4697..11b068f 100644 --- a/packages.nix +++ b/packages.nix @@ -12,6 +12,7 @@ packages = libraries = with nixpkgs.haskellPackages; [ + sdl2 ]; # Haskell dev packages. Install only dependencies of these in the shell, From 9b853c74a12455f67bee4679bac41e682351c6b2 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 16 Apr 2026 18:01:15 +0530 Subject: [PATCH 15/15] Add sdl2 flag in CI Use allow-newer for sdl2 --- .github/workflows/haskell.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index f64bd03..9c4ce13 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -162,13 +162,14 @@ jobs: # CABAL_PROJECT=cabal.project.ghc-head # DISABLE_SDIST_BUILD="y" - - name: ci + - name: sdl2 runner: ubuntu-latest command: cabal ghc_version: 9.14.1 # WARNING! cannot use # comments inside pack_options. pack_options: >- CABAL_PROJECT=cabal.project.user + CABAL_BUILD_OPTIONS="--flag sdl2 --allow-newer" - name: ci runner: macos-latest @@ -407,6 +408,15 @@ jobs: } EOF + - name: Install sdl2 + if: runner.os == 'Linux' + shell: bash + run: | + if [[ "$MATRIX_OPTIONS" == *sdl2* ]] + then + sudo apt-get update && sudo apt-get install -y libsdl2-dev + fi + - name: Run packcheck (dependencies only) id: deps-only # Check the relevant step based on the runner OS