1
0
Fork 0
mirror of https://git.anardil.net/austin/coreutils.git synced 2026-11-18 11:00:04 +00:00
Unix core utilities implemented in Haskell
  • Haskell 86.6%
  • Shell 13.3%
Find a file
Gandalf- c0f23caf46 jot repeats the start for a zero step and refuses a range no step fits, as BSD does (#201)
The bounds properties were disabled since 2024: one asserted the last value
meets the upper bound, false whenever the step doesn't divide the span, and
the other failed on float rounding. Both are restated over whole numbers.
A count with a worked-out bound now stands unclamped, as BSD's does. Also
re-enables seq's away-pointing increment test and netcat's UDP pair test,
which wrote from the unconnected socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 14:34:41 -08:00
Coreutils jot repeats the start for a zero step and refuses a range no step fits, as BSD does (#201) 2026-11-14 14:34:41 -08:00
src shuf is GNU's, drawn from the same bytes, and in the dispatch table (#438) 2026-11-04 10:10:39 -08:00
test jot repeats the start for a zero step and refuses a range no step fits, as BSD does (#201) 2026-11-14 14:34:41 -08:00
.gitignore switch to package.yaml 2025-12-30 13:29:53 -08:00
.hspec more parallel tests 2026-03-29 10:19:49 -07:00
CLAUDE.md cmp is BSD's, streamed, and in the dispatch table (#433) 2026-11-03 22:28:36 -08:00
LICENSE Initial commit 2018-09-02 09:39:12 -07:00
Makefile coreutils: lines are held to 100 columns by make lint (#456) 2026-11-06 12:58:48 -08:00
package.yaml shuf is GNU's, drawn from the same bytes, and in the dispatch table (#438) 2026-11-04 10:10:39 -08:00
README.md shuf is GNU's, drawn from the same bytes, and in the dispatch table (#438) 2026-11-04 10:10:39 -08:00
stack.yaml stack lts 24.24 2025-12-30 12:52:08 -08:00
todo.md shuf is GNU's, drawn from the same bytes, and in the dispatch table (#438) 2026-11-04 10:10:39 -08:00

coreutils

Unix core utilities implemented in Haskell.

Goals are:

  • Idiomatic implementations
  • Fast, lazy IO
  • Feature parity with BSD utils
  • Fully tested
  • Platform independent
Utility Idiomatic Fast Lazy Tests Complete
addrinfo ✓ - - ✓ 80
awk ✓ ✓ ✓ 40
basename ✓ - - ✓ ✓
cat ✓ ✓ ✓ ✓
cmp ✓ ✓ ✓ ✓ ✓
column ✓ ✓ - ✓ ✓
cut 75 ✓ 90 90
dirname ✓ - - ✓ ✓
du ✓ - ✓ 95
echo ✓ - - ✓ ✓
env ✓ - - ✓ ✓
exit ✓ - - ✓ ✓
expr ✓ - - ✓ 90
false ✓ - - ✓ ✓
head ✓ ✓ ✓ ✓ ✓
ls ✓ ✓ - ✓ 50
mkdir ✓ - - ✓ ✓
nl ✓ ✓ ✓ ✓ ✓
nologin ✓ - - - ✓
paste ✓ ✓✓ ✓ ✓ ✓
pwd ✓ - - - ✓
random ✓ - - ✓ ✓
readlink ✓ - - ✓ ✓
realpath ✓ - - ✓ ✓
rev ✓ ✓ ✓ ✓ ✓
seq ✓ 75 ✓ ✓ ✓
shuf ✓ - ✓ ✓
sleep ✓ - - ✓ ✓
split ✓ ✓ ✓ ✓ ✓
sponge ✓ ✓ - ✓ ✓
strings ✓ ✓ ✓ ✓ ✓
sum ✓ ✓ ✓ ✓ ✓
tac ✓ ✓ ✓ ✓ ✓
tail ✓ ✓ ✓ ✓ ✓
tee ✓ ✓ ✓ ✓ ✓
test ✓ ✓ ✓ ✓ ✓
tr ✓ 75 ✓ ✓ ✓
truncate ✓ ✓ - ✓ ✓
true ✓ - - ✓ ✓
uniq ✓ ✓ ✓ ✓ ✓
wc ✓ ✓ ✓ ✓
which ✓ - - - ✓
whoami ✓ - - - ✓
yes ✓ ✓ ✓ - ✓
Symbol Meaning
✓✓ Superior
✓ Complete
% % Partial
- Not applicable

Usage

This project compiles to a single executable which detects which utility to call depending on the name of the binary.

make release

or

stack install --flag coreutils:release

Platform Independent

With utils on your path, you can call any utility by name, using the name as the first argument.

I leaf@elm ~> utils echo hello | utils rev
olleh
C:\Users\leaf>utils echo hello | utils rev
olleh

This is the best option for trying things out without committing your entire shell to these implementations. The testing done is mostly thorough, but there's some crazy usage of the coreutils out in the wild; like cat - - - in build scripts. Who needs to read stdin three separate times? The standard Haskell IO libraries make some sane assumptions that things like this don't happen, so this project has balance ugly workarounds with idomatic behavior. Where reasonable, idomatic is preferred. Further, this project relies on the Haskell IO libraries for platform independence - where they decided to simplify (permissions, file types), this project does also.

Linux, FreeBSD, MacOS

If you do want to commit, symlink the utilities you'd like to expose to your $PATH variable. If ~/.local/bin/ has precedence over /bin/ and /usr/bin/, these are the versions your shell will use.

cd ~/.local/bin/
ln -s utils cat
ln -s utils sleep
ln -s utils rev
...
I leaf@elm ~> which which
/home/leaf/.local/bin/which

On Windows

Symlinking doesn't appear to change the name reported by System.Environment.getProgName, so you'll need to create copies of the binary with different names.

PS C:\> cd (Split-Path -Parent (Get-Command utils.exe).Path)
PS C:\Users\leaf\AppData\Roaming\local\bin> cp utils.exe which.exe
PS C:\Users\leaf\AppData\Roaming\local\bin> cd C:\
PS C:\> which calc.exe
C:\WINDOWS\system32\calc.exe
PS C:\> which which.exe
C:\Users\leaf\AppData\Roaming\local\bin\which.exe