John Goerzen: Announcing HSH, the Haskell Shell
Following the "release early, release often" motto, I am happy to announce version 0.1.0 of HSH, the Haskell shell.
You may obtain it with:
darcs get --tag 0.1.0 http://darcs.complete.org/hsh
Things are still very rough in many ways, but this version already lets you:
Here is an example session: (some lines wrapped for readability)
You may obtain it with:
darcs get --tag 0.1.0 http://darcs.complete.org/hsh
Things are still very rough in many ways, but this version already lets you:
- Run commands
- Pipe things between commands
- Pipe command input/output into and out of pure Haskell functions
- Pure Haskell functions are as much a first-class citizen as is grep or cat
Here is an example session: (some lines wrapped for readability)
$ ghci -fglasgow-exts HSH
*HSH> run $ ("ls", ["."])
COPYING HSH HSH.hs TODO announcements testsrc
COPYRIGHT HSH.cabal Makefile _darcs test.hs
*HSH> run $ ("ls", ["-l"]) - - ("wc", ["-l"])
12
*HSH> :m +Text.Printf
*HSH Text.Printf> let countLines = (zipWith (\i line -> printf "%-5d %s" i line)
[(1::Int)..])::([String] -> [String])
*HSH Text.Printf> run $ ("ls", ["-l"]) - - countLines - - ("grep", ["hs$"])
6 -rw-r--r-- 1 jgoerzen jgoerzen 1285 Jun 6 09:43 HSH.hs
11 -rw-r--r-- 1 jgoerzen jgoerzen 565 Jun 6 09:43 test.hs
*HSH Text.Printf> :m +Data.List
*HSH Text.Printf Data.List> run $ ("ls", ["-l"]) - - countLines - -
filter (isSuffixOf "hs")
6 -rw-r--r-- 1 jgoerzen jgoerzen 1285 Jun 6 09:43 HSH.hs
11 -rw-r--r-- 1 jgoerzen jgoerzen 565 Jun 6 09:43 test.hs
*HSH Text.Printf Data.List> run $ ("ls", ["-l"]) - - countLines - - filter (isSuffixOf "hs")
- - ("tr", ["a-z", "A-Z"])
6 -RW-R--R-- 1 JGOERZEN JGOERZEN 1285 JUN 6 09:43 HSH.HS
11 -RW-R--R-- 1 JGOERZEN JGOERZEN 565 JUN 6 09:43 TEST.HS
*HSH Text.Printf Data.List> let generator = \(_::String) -> unlines . map show $ [1..20]
*HSH Text.Printf Data.List> generator ""
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"
*HSH Text.Printf Data.List> run $ generator - - ("grep", ["1"])
1
10
11
12
13
14
15
16
17
18
19
Future versions will likely simplify syntax to make it easier to write scripts and introduce a sh to hsh converter. I also plan to add pure Haskell tools for some common shell-ish things that one could do in Haskell.
That’s the building, though when I took the picture, I did not know on which side the apartment would be, and it turned out this is not the side. Would have been nice, though: a view to a small patch of forest, beyond which I could have seen (barely) the old building.
Instead, my view from the windows is toward the yard-cum-parking-lot, though it is possible to vary this a lot by choosing the angle (one angle gives a view toward another forest patch).
The first picture is from the kitchenette, the others are from the single room, which I call the living room. I also have a kitchenette —
— and an alcove (which I call the bedroom).
The bathroom hopefully doesn’t have a mold problem, but probably does. It’s of the older design that frequently didn’t take moisture and water protection seriously enough. Well, at least there are no outward signs of such a problem, and the air circulation system definitely works. I apologise for the poor quality of this picture:
I got the keys on the first of this month, and promptly moved in a spring mattress. The next day I walked nearly the recommended 10,000 steps in handling all kinds of issues, including buying a very nice lamp and a barstool to the kitchenette.
I got cable service on Monday and am now writing this on my laptop in the kitchenette sitting on the barstool, over a wireless network that is connected to the cable modem.