Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
575 changes: 455 additions & 120 deletions .github/workflows/haskell.yml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions .packcheck.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ hie.yaml
appveyor.yml
default.nix
stack.yaml
cabal.project.d/master
cabal.project.d/master-Werror
cabal.project.d/streamly-master
cabal.project.d/Werror
cabal.project.d/streamly-0.9.0
cabal.project.d/streamly-0.10.0
flake.lock
flake.nix
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.4.1 (Apr 2026)

* Rename quotedWord to shellWord

## 0.4.0 (Sep 2025)

* Remove buffering from the pipe chunked APIs.
Expand Down
72 changes: 35 additions & 37 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# packcheck-0.7.0
# 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.
branches:
only:
- master

#branches:
# only:
# - master

environment:
# ------------------------------------------------------------------------
Expand All @@ -14,42 +15,37 @@ 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.12.4"
#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"

# ------------------------------------------------------------------------
# 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-22.0"
STACK_ROOT: "c:\\sr"
STACK_YAML: "stack.yaml"
# On Windows, DISABLE_SDIST_BUILD is useful for (1) avoiding
# path length restriction, (2) avoid installing autoreconf
# for configure builds.
DISABLE_SDIST_BUILD: "y"
# Note: these require the "diff" utility.
# DISABLE_SDIST_GIT_CHECK: "y"
DISABLE_SDIST_PROJECT_CHECK: "y"

# ------------------------------------------------------------------------
# cabal options
# ------------------------------------------------------------------------
CABAL_CHECK_RELAX: "y"
CABAL_HACKAGE_MIRROR: "hackage.haskell.org:http://hackage.fpcomplete.com"

# ------------------------------------------------------------------------
# Where to find the required tools
# ------------------------------------------------------------------------
PATH: "%PATH%;%APPDATA%\\local\\bin"
LOCAL_BIN: "%APPDATA%\\local\\bin"
#CABAL_PROJECT: "cabal.project"

# ------------------------------------------------------------------------
# Location of packcheck.sh (the shell script invoked to perform CI tests ).
Expand All @@ -62,31 +58,33 @@ environment:
# 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/composewell/packcheck"
PACKCHECK_GITHUB_COMMIT: "v0.7.0"
PACKCHECK_GITHUB_COMMIT: "dd9ba87d2a42c7cd1d96e3946636c07e732587b4"

# 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%"
4 changes: 4 additions & 0 deletions cabal.project.d/Werror
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: streamly-process.cabal

package streamly-process
ghc-options: -Werror
15 changes: 0 additions & 15 deletions cabal.project.d/master-Werror

This file was deleted.

4 changes: 2 additions & 2 deletions cabal.project.d/streamly-0.10.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages: streamly-process.cabal

constraints:
streamly == 0.10.0.*
, streamly-core == 0.2.0.*
streamly == 0.10.*
, streamly-core == 0.2.*
File renamed without changes.
88 changes: 88 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
description = "streamly-process";

inputs = {
basepkgs.url = "git+ssh://git@github.com/composewell/streamly-packages?rev=187bde6bd362eced707ed96198ddc193af66ff42";
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-process";
sources = basepkgs.nixpack.lib.localSource "streamly-process" ./.;
packages = basepkgs.nixpack.lib.devPackage "streamly-process";
#sources = import ./sources.nix;
#packages = import ./packages.nix;
};
}
12 changes: 6 additions & 6 deletions src/Streamly/System/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@
-- :}
-- HELLO WORLD
--
-- Here, system commands are run as independent processes and composed
-- directly in Haskellwithout invoking a shell. This offers a powerful,
-- type-safe, and efficient alternative to shell scripting, using Streamly’s
-- streaming APIs for composition.
-- In the example above, system commands are run as independent processes and
-- composed directly in Haskell, without invoking a shell. This offers a
-- powerful, type-safe, and efficient alternative to shell scripting, using
-- Streamly’s streaming APIs for composition.
--
-- = Shell Commands as Functions
--
-- Prefer running commands directly and composing their output in Haskell (see
-- previous example) instead of relying on a shell interpreter. If you want to
-- run a command using shell as interpreter, you can invoke it like this:
-- previous example) instead of using shell pipes. But if you really want to
-- run a command using shell as interpreter, you can do that too like this:
--
-- >>> :{
-- Command.toBytes [str|sh "-c" "echo 'hello world' | tr [a-z] [A-Z]"|]
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-22.0
resolver: lts-24.37
packages:
- '.'
extra-deps:
Expand Down
51 changes: 29 additions & 22 deletions streamly-process.cabal
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
cabal-version: 2.2
name: streamly-process
version: 0.4.0
synopsis: Use OS processes as stream transformation functions
version: 0.4.1
synopsis: Write shell-like command pipelines in Haskell
description:
Use operating system (OS) commands in Haskell programs as if they were
native Haskell functions, by treating their inputs and outputs as
Haskell streams. This allows you to write high-level Haskell scripts
that can perform tasks similar to shell scripts, but with C-like
performance, and with strong safety guarantees, refactorability, and
modularity.
Treat operating system (OS) processes as first-class stream
transformations in Haskell. This package lets you compose external
commands as if they were native Haskell functions, connecting
their inputs and outputs through typed streams and perform tasks
concurrently. It let's you do your scripting tasks in Haskell with
near-native performance.
.
The API is designed to be concise and ergonomic, making it easy
to express complex pipelines with minimal boilerplate. You can
build high-level, declarative workflows similar to shell scripts
while retaining Haskell’s strengths: type safety, composability,
refactorability, and modular design. Moreover, you get the concurrent
compositions and C-like performance of streamly.
homepage: https://streamly.composewell.com
bug-reports: https://github.com/composewell/streamly-process/issues
license: Apache-2.0
Expand All @@ -18,21 +25,21 @@ maintainer: streamly@composewell.com
copyright: Composewell Technologies
category: Streamly, Streaming, System
stability: Experimental
tested-with: GHC==9.10.1
, GHC==9.8.1
, GHC==9.6.3
, GHC==9.4.4
, GHC==9.2.7
, GHC==9.0.2
, GHC==8.10.7
, GHC==8.8.4
, GHC==8.6.5
build-type: Simple
extra-source-files:
tested-with:
GHC==9.14.1
, GHC==9.12.4
, GHC==9.10.3
, GHC==9.8.4
, GHC==9.6.3
, GHC==9.4.8
, GHC==8.10.7
build-type: Simple
extra-doc-files:
CHANGELOG.md
NOTICE
README.md
design/proposal.md
extra-source-files:
src/DocTestCommand.hs
src/DocTestProcess.hs
test/data/failExec.bat
Expand Down Expand Up @@ -107,7 +114,7 @@ library
else
if !os(windows)
build-depends:
unix >= 2.5 && < 2.8
unix >= 2.5 && < 2.9

-------------------------------------------------------------------------------
-- Benchmarks
Expand All @@ -130,7 +137,7 @@ benchmark Benchmark.System.Process
, directory >= 1.2.2 && < 1.4
-- Uses internal APIs
, streamly-core
, tasty-bench >= 0.2.5 && < 0.5
, tasty-bench >= 0.2.5 && < 0.6

if flag(fusion-plugin) && !impl(ghc < 8.6)
build-depends:
Expand All @@ -150,6 +157,6 @@ test-suite Test.System.Process
, directory >= 1.2.2 && < 1.4
, exceptions >= 0.8 && < 0.11
, hspec >= 2.0 && < 3
, QuickCheck >= 2.10 && < 2.16
, QuickCheck >= 2.10 && < 2.19
-- Uses internal APIs
, streamly-core
Loading