My main use for this is incremental migration away from bash. I'm not saying this is the best way to do scripts, but it's a pretty great stepping stone. Just following the cargo culting guide [0] can already uplift a bash script without changing the logic too much. From there you can start adding structure.
My secondary use case is little scripts in NixOS/nixpkgs. There are some helpers in there that make it quite convenient.
[0] https://github.com/luke-clifton/shh/blob/master/docs/porting...
It seems a lot less full-featured than https://xon.sh/, but maybe you don't need a lot of bells and whistles for regular usage. I mostly run build, execute, and install commands.
I'm somewhat enticed at the possibility of being able to wrap common executables into forms that are typed (like nushell or elvish) and manipulate them in a way that leverages the type checker.
https://hackage.haskell.org/package/turtle/docs/Turtle-Tutor...
https://hackage.haskell.org/package/shelly
shh's "Alternatives" section summarises nicely some of the differences between these:
https://github.com/luke-clifton/shh#alternatives
shh has a neat [fmt| ... |] macro that gets you around escaping strings.
shh generally has more Template Haskell support; you may or may not like this.
I am personally leaning towards shh because of its "native pipe style".
Per the README, this is actually the work of https://hackage.haskell.org/package/PyF
https://github.com/oilshell/oil/wiki/Internal-DSLs-for-Shell
e.g. points to another Haskell project, which may be old - https://github.com/jgoerzen/hsh/wiki
Which is related to the list of free-standing shells:
https://youtu.be/yXcwK3XNU3Y?si=XuABEBZReyfhraAh
Haven't tried it though.
This project could really benefit from picking up a couple of steady contributors. It looks like the author is a new dad, and his commit history looks about like what mine did at that stage.
These days https://babashka.org/ is a much better option. It's powerful, fast, modern, works everywhere and has effortless multitasking.
https://wryun.github.io/es-shell/
to run (a functionalish shell)
Yes, you came up with a nice syntax for your Haskell scripts, but what it cost to install all required dependencies on, for example, newly created Ubuntu server?
That's been one of the somewhat unexpected benefits for me with NixOS: it's so easy to pull in tools and libraries that I don't have to worry about using less popular options.
Nixpkgs is just Nix used as a metalanguage for splicing together bash object language programs.
Guix is what it looks like when you really get away from bash -- they use scheme as both the metalanguage and the object language.
Lua can be built from source in a few seconds on just about any system and can be used pretty easily as a bash replacement. You can even bundle the lua script in a bash script that idempotently installs lua and then calls the lua script embedded in heredoc.
I don’t get the impression that this is supposed to be the final solution to Bash.
> /bin/bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)
Copyright (C) 2007 Free Software Foundation, Inc.Development is best done on well setup workstations.
The best alternative I've found so far is Deno. It natively supports single file scripts with third party dependencies (this is a big issue with replacing Bash with Python). It uses an existing popular language (so now "learn our weird language" problem). Installation is very easy.
The only real downside I've found is this stupid bug that they refused to fix:
https://github.com/williamcotton/fs_playground/blob/main/Scr...
Thanks for this, I’m going to borrow a lot of your concepts, especially the added infix operators, those are slick!