TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Shh: Simple Shell Scripting from Haskell

199 pointsby subsetover 1 year ago

7 comments

themkover 1 year ago
Author here.<p>My main use for this is incremental migration away from bash. I&#x27;m not saying this is the best way to do scripts, but it&#x27;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.<p>My secondary use case is little scripts in NixOS&#x2F;nixpkgs. There are some helpers in there that make it quite convenient.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;luke-clifton&#x2F;shh&#x2F;blob&#x2F;master&#x2F;docs&#x2F;porting.md">https:&#x2F;&#x2F;github.com&#x2F;luke-clifton&#x2F;shh&#x2F;blob&#x2F;master&#x2F;docs&#x2F;porting...</a>
cole-kover 1 year ago
Those of you who use (or used) this as your shell: care to share your experience?<p>It seems a lot less full-featured than <a href="https:&#x2F;&#x2F;xon.sh&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;xon.sh&#x2F;</a>, but maybe you don&#x27;t need a lot of bells and whistles for regular usage. I mostly run build, execute, and install commands.<p>I&#x27;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.
评论 #38414370 未加载
sshineover 1 year ago
shh is a really cool package, and so is turtle and shelly:<p><a href="https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;turtle&#x2F;docs&#x2F;Turtle-Tutorial.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;turtle&#x2F;docs&#x2F;Turtle-Tutor...</a><p><a href="https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;shelly" rel="nofollow noreferrer">https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;shelly</a><p>shh&#x27;s &quot;Alternatives&quot; section summarises nicely some of the differences between these:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;luke-clifton&#x2F;shh#alternatives">https:&#x2F;&#x2F;github.com&#x2F;luke-clifton&#x2F;shh#alternatives</a><p>shh has a neat [fmt| ... |] macro that gets you around escaping strings.<p>shh generally has more Template Haskell support; you may or may not like this.<p>I am personally leaning towards shh because of its &quot;native pipe style&quot;.
评论 #38418670 未加载
fuzztesterover 1 year ago
Related: has anyone tried scheme shell (scsh) and what is your experiences with it?<p><a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Scsh" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Scsh</a>
评论 #38413716 未加载
评论 #38413632 未加载
评论 #38413536 未加载
评论 #38414134 未加载
评论 #38414103 未加载
评论 #38416605 未加载
评论 #38415683 未加载
ben0x539over 1 year ago
This seems fun! Far too few people who are all &quot;your bash scripts shouldn&#x27;t be 300 lines and have complex logic!&quot; address why people reach for bash scripts in the first place, so kudos for that.
ekiauhceover 1 year ago
You can’t really move away from bash, unless there would be alternative as widely available on different Unix systems as bash is.<p>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?
评论 #38414968 未加载
评论 #38414793 未加载
评论 #38414352 未加载
评论 #38414578 未加载
评论 #38414328 未加载
评论 #38414382 未加载
评论 #38414787 未加载
评论 #38414374 未加载
williamcottonover 1 year ago
Huh, I was just tinkering with the same sort of thing with the same motivations but with F#:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;williamcotton&#x2F;fs_playground&#x2F;blob&#x2F;main&#x2F;Scratchpad&#x2F;PltAwk.fsx">https:&#x2F;&#x2F;github.com&#x2F;williamcotton&#x2F;fs_playground&#x2F;blob&#x2F;main&#x2F;Scr...</a><p>Thanks for this, I’m going to borrow a lot of your concepts, especially the added infix operators, those are slick!