H4sh – Exposing the Haskell List library as a set of shell utilities
github.com
github.com
https://wiki.haskell.org/Applications_and_libraries/Operatin...
> h4sh was written during a cold, but sunny weekend in August 2005.
hs-plugins looks so cool, but I'm afraid it's bit-rotten and abandoned. :(
$ txr -t '[(opip get-lines (mapcar length) sort reverse)]' | head
asdfasdf
adsfas
da
sfa
f
sdfadsf
asd
asdf
[Ctrl-D]
8
7
6
4
3
3
2
1
0
Pattern for wrapping any list processing function as a command: $ mapcar()
> {
> txr -t "[(opip get-lines (mapcar $@))]"
> }
$ mapcar length < /etc/motd
63
0
43
0
28
33
0
36
42
0
Bored now.IMO a much better way to go about it would be to encode filesystem operations inside a monad. Then you could chain together filesystem operations to make up some sort of transformation, then after it's built up apply the operations to the real filesystem. It achieves something similar, but doesn't require any sort of filesystem support.
You can manually get filesystem snapshots with say `btrfs subvolume snapshot`, but the shell doesn't care about that. It doesn't ever deal with the filesystem directly, it either asks the kernel to do something or calls a program that asks the kernel to do something. To draw an analogy to databases (which are usually essentially based on immutable data structures in the sense that they're transactional), this would be like asking the postgresql command line client to handle making sure that the actual database manipulations are done transactionally. It doesn't quite make sense, that sort of business belongs in the postgresql server (which would be the OS kernel in our analogy here).
It's OT; regarding attic. Could I shoot some basic questions, here or on an email?