News for hackers. Stuff that matters.
Re:H4sh – Exposing the Haskell List library as a set of shel... by cies on Monday July 13, 2015 @05:48AM (#9877154)
I added it to a list that I maintain on the Haskell wiki, trying to sum up all Haskell effort related to shell scripting:

https://wiki.haskell.org/Applications_and_libraries/Operatin...

Re:H4sh – Exposing the Haskell List library as a set of shel... by Mayeu on Monday July 13, 2015 @08:10AM (#9877585)
:+1:
Re:H4sh – Exposing the Haskell List library as a set of shel... by xnyhps on Monday July 13, 2015 @06:19AM (#9877224)
I was going to post that I was happy to see a new project using hs-plugins, but then I noticed:

> 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. :(

Re:H4sh – Exposing the Haskell List library as a set of shel... by cies on Monday July 13, 2015 @09:17AM (#9877883)
Here is a particular update of hs-plugins:

https://github.com/Changaco/haskell-plugins

Re:H4sh – Exposing the Haskell List library as a set of shel... by kazinator on Monday July 13, 2015 @04:12PM (#9880724)
> take 100 data | map show.length | sort | reverse | head

   $ 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.
Re:H4sh – Exposing the Haskell List library as a set of shel... by t0rb3n on Monday July 13, 2015 @07:57AM (#9877521)
How can you not name this 'hashell'?
Re:H4sh – Exposing the Haskell List library as a set of shel... by Mayeu on Monday July 13, 2015 @08:10AM (#9877584)
Re:H4sh – Exposing the Haskell List library as a set of shel... by t0rb3n on Monday July 13, 2015 @08:18AM (#9877636)
woah, that's a lot of shells ^^
Re:H4sh – Exposing the Haskell List library as a set of shel... by amelius on Monday July 13, 2015 @05:29AM (#9877113)
Can it also make immutable copies (snapshots) of the filesystem?
Re:H4sh – Exposing the Haskell List library as a set of shel... by gh02t on Monday July 13, 2015 @12:51PM (#9879284)
Doubt it. That's something done by the filesystem itself and doesn't really belong in the shell. You can do it with btrfs or zfs though. LVM too.
Re:H4sh – Exposing the Haskell List library as a set of shel... by balladeer on Saturday July 18, 2015 @02:54AM (#9906809)
Since I couldn't find your contact, I had to track you down here. Sorry :-)

It's OT; regarding attic. Could I shoot some basic questions, here or on an email?

Re:H4sh – Exposing the Haskell List library as a set of shel... by amelius on Monday July 13, 2015 @04:19PM (#9880767)
But immutability is something I'd expect from a functional language/shell.
Re:H4sh – Exposing the Haskell List library as a set of shel... by gh02t on Monday July 13, 2015 @05:25PM (#9881228)
It's not something I'd expect. A shell deals with plumbing together programs and files, which are an abstraction over the actual raw filesystem (which is exposed by the kernel). For a shell to do true snapshots, it'd have to talk to the underlying filesystem. In theory this is possible I guess, but then your "shell" needs to be the compatible with the filesystem you're in, which is a very weird situation.

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).