
Ask HN: Can ghci realistically replace bash? - xelxebar
I live almost entirely in the command line; the only non-cli tool I use regularly is my browser. Also, I&#x27;d like to learn me a Haskell.<p>Learning Haskell has been a goal of mine for a while actually, and I&#x27;ve had false starts with some of the existing, excellent learning resources:<p>* Brent Yorgey&#x27;s CS194 course,
* Learn You a Haskell for Great Good!, and
* Write Yourself a Scheme in 48 Hours.<p>So it occurred to me that I might <i>actually</i> learn if I started inserting Haskell into my current workflow. Better yet, if userspace is &quot;just&quot; tooling that calls into the kernel syscall API, it&#x27;s concievably possible to replace everything with Haskell.<p>That being the goal, I have played with ghci along with a couple of the &quot;Haskell scripting&quot; libraries:<p>* shelly
* turtle<p>These are great tools, but I&#x27;d like to learn how to do things the <i>Haskell Way</i> instead of just wrapping my familiar tools in thin Haskelly types. So, in the course of my (limited) explorations, here are some questions and issues I&#x27;ve encountered:<p>* Can I install and load a new package from within ghci (i.e. do the equivalent of &quot;stack install ...&quot;)?
* Is it possible to intelligently manage a git repository without calling out to the git binary? (I&#x27;m aware of the &#x27;git&#x27; package but not familiar with it enough to judge usability.)
* How would SSHing into a machine even work?
* What are some ways to serialize typed data while keeping things &quot;just text&quot; and human readable?
* How do we pretty print things like directory listings etc.?
* Am I just being ridiculous?<p>Anyway, this isn&#x27;t a comprehensive list of questions, but if any of you use Haskell as your primary method of interacting with the system, I&#x27;d like to hear what libraries and workflows you have.<p>Cheers!
======
brudgers
To me, you are being curious not ridiculous. The idea of using Haskell as an
interactive shell seems like a great learning exercise and worth pushing as
far as you are willing to go. Even if from a practical standpoint, rewriting
the entire *nix stack in Haskell is probably more than a lifetime's work.

Technically, to me recreating Bash in Haskell to swim in the Turing Tarpit.
[1] Some programming languages are mostly ready to serve as an operating
system shell, e.g. Common Lisp (Lisp machines), Smalltalk, Erlang, or QBasic.
[2] Others are not because there is a difference between the abstraction of an
interpreter and the abstraction of a shell. One of them is session duration.

The interpreter abstraction tends toward: starting the interpreter from a
shell, running a sequence of commands, exiting to the shell. The shell
abstraction tends toward starting (perhaps recursively from another shell) and
possibly running indefinitely until crashing or the heat death of the universe
whichever comes first. SSH is a great example of the recursive and indefinite
temporal extent of shells. Python's global interpreter lock is a reasonable
example of the interpreter abstraction.

Good luck.

[1]:
[https://en.wikipedia.org/wiki/Turing_tarpit](https://en.wikipedia.org/wiki/Turing_tarpit)

[2]: or Bash.

------
PaulHoule
Why is it that when people can't do something with PHP they think that "PHP is
stupid" but if they can't do it with Haskell they think they are stupid?

~~~
jetti
Just a guess but it could have something to do with the perceived language.
PHP is something that is perceived to be easy to pick up and easy to work
with. If you can't do something with it that becomes a language issue because
you are smart enough to use such a "simple language". Haskell, on the other
hand, is seen as this language for "smart people". If one can't figure out how
to do something in Haskell it is easier to say that they just aren't smart
enough for the language.

------
tome
The Haskell subreddit would be a much better place to ask this question.

