
FuncShell – A Haskell-based alternative to awk - _iostreamer_
https://github.com/iostreamer-X/FuncShell
======
jaytaylor
Do any of you know how they got such a beautiful looking shell [0]? I'd love
to know if there's a clean way to achieve such a nice result.

[0]
[https://github.com/iostreamer-X/FuncShell/raw/master/fsh.gif](https://github.com/iostreamer-X/FuncShell/raw/master/fsh.gif)

 _EDIT_

As an aside, FuncShell looks like a beautiful demonstration of how powerful
Haskell can be. The source code is terse and clean.

The only oddity I noticed isthe rather large 68MB binary file committed into
master in the repository [1]. Why do people do this? Especially on GitHub
where there's support for cutting releases with a binary for each targeted
platform...

[1]
[https://github.com/iostreamer-X/FuncShell/blob/master/fsh](https://github.com/iostreamer-X/FuncShell/blob/master/fsh)

~~~
_iostreamer_
>The only oddity I noticed isthe rather large 68MB binary file committed into
master in the repository.

Thanks for bringing it to notice. I did this and later realized I can opt for
the github release option[0]. I will fix this and the installation url asap.

[0]
[https://github.com/iostreamer-X/FuncShell/releases](https://github.com/iostreamer-X/FuncShell/releases)

~~~
Filligree
Unfortunately, unless you rewrite history, it'll stay in there and bloat the
download for anyone who wants to clone the repo.

I don't know if I want to recommend rewriting history or not. But for what
it's worth, I'm currently on a cellular connection and couldn't download
something this size if I wanted.

~~~
mitchty
git clone --depth 1 if you don't need the history?

------
tyingq
Similar idea, but uses sqlite to make an awk like utility with sql syntax:
[https://github.com/dbohdan/sqawk](https://github.com/dbohdan/sqawk)

~~~
jaytaylor
And just yesterday, people were asking [0] what Tcl is good for! This is a
great example.

[0]
[https://news.ycombinator.com/item?id=14229266](https://news.ycombinator.com/item?id=14229266)

------
rnhmjoj
What happened to hell[1]? It was apparently destroyed by this commit[2].

[1]:
[https://www.reddit.com/r/programming/comments/1r7oci/hell_a_...](https://www.reddit.com/r/programming/comments/1r7oci/hell_a_haskell_shell/)

[2]:
[https://github.com/chrisdone/hell/commit/f34259e5e92f6edf464...](https://github.com/chrisdone/hell/commit/f34259e5e92f6edf464b65d9735965b0533b470b)

------
heinrichhartman
Similar idea, but uses LUA as inline language:
[https://github.com/HeinrichHartmann/luawk](https://github.com/HeinrichHartmann/luawk)

``` > printf abc | luawk -p '_:gsub("a","A")'

Abc ```

~~~
srean
An awk with a luajit backend would be quite interesting.

------
omaranto
Similar tools that use Python as the query language:

\- The Pyed Piper:
[https://code.google.com/archive/p/pyp/](https://code.google.com/archive/p/pyp/)

\- Puffin:
[https://github.com/kespindler/puffin](https://github.com/kespindler/puffin)

------
gregwebs
Nice! How do I bring new function into scope though? This looks very similar
to hawk, which has documentation on how to add your custom code [1].

Also, there are some nice CLI tools for JSON [2] or CSV [3] specific data.

    
    
      [1] https://github.com/gelisam/hawk
      [2] https://stedolan.github.io/jq/manual/
      [3] https://github.com/BurntSushi/xsv/blob/master/README.md

~~~
codygman
I think hawk should steal the idea of aliasing "|]" personally ;)

------
baldfat
I always have mixed feelings on awk alternatives. I find awk to be one of the
most underused tools in scripting. Awk has saved me numerous of times.

Now replacing latex with a modern syntax would be awesome!!!

~~~
RodericDay
I tried to explain to a historian with an open source textbook initiative the
basics of latex. As soon as I opened the demo page that had looked nice
enough, with him by my side, my heart sank. It's just so far away from being
usable by non-technical users.

It's too bad, really.

~~~
baldfat
A good theme and sharelatex.com can go a long way to get someone to use it. I
usually only get Math Majors to invest in it.

I did almost all my Master Theology papers in it. Just difficult to use
different languages. I usually have to use one or all of these Greek, Hebrew,
Aramaic, Latin, Danish or German in my papers. Latex didn't make that easy.
Actually nothing does.

~~~
RodericDay
I used sharelatex.

the notation full of \, {, }, etc. is just too confusing for people.

~~~
Jach
What isn't too confusing then? Markdown and HTML are just riffs, it's all
based around the idea of opening/closing tokens and special tag names that do
different things. I think if there is in fact a technical barrier, then it's
the underlying fact that your representation of a document has a separation of
content and design/layout. If people can't deal with that, then they can only
use WYSIWYG (and not the hacks of rendering to the side while you still type
in TeX), and there's no point in trying to update LaTeX's notation to fit
people who never will get that underlying separation.

~~~
sokoloff
Markdown has fewer ways to inexplicably (from the point of view of a naive
user) munge text.

If you type plain text, it mostly comes out as plain text.

I've paid John $4.50 for a sandwich.

Renders fine in Markdown. Renders like crap in LaTeX.

~~~
ams6110
Markdown has its own magic incantations that can infuriate if you don't get
them just right. GP is right: most people can't handle markup languages,
period. Or, they can, but _vastly_ prefer WYSIWYG text formatting.

For me, if I'm writing something for a web page, I use HTML in a decent editor
(emacs). Markdown, reST, or anything else is not easier, just different.

If I need a really nice-looking document, I'll probably use LaTeX. But for a
simple document or one that I'll work on with other people, I'll normally just
use google docs.

------
codewithcheese
I like how you made this version use pipes instead of being a shell. Do you
have any plans to create a new JS version of Awkward using pipes?

~~~
_iostreamer_
I understand that this caters to a very specific audience which knows haskell.
Hence I plan to support JS as the inline language. I don't want to create a
new JS version because I want to learn more of Haskell :p

------
ilurkedhere
In typical usage, do you need the type hints much? I saw ":: Float" in there
for the df example, for instance.

~~~
_iostreamer_
Not really, in the example of df, I was filtering on the basis of size, which
is not int usually but a decimal value, hence I had to provide the type hint.

------
rocqua
I'm amazed by the powerline-command prompt. Shiny things seem to draw my
attention a bit too much.

~~~
c0achmcguirk
Haha, me too! I want to read an article on getting my zsh prompt to look like
that.

~~~
baldfat
Windows -
[https://amreldib.com/blog/CustomizeWindowsCmderPrompt/](https://amreldib.com/blog/CustomizeWindowsCmderPrompt/)

zsh -
[https://gist.githubusercontent.com/agnoster/3712874/raw/c310...](https://gist.githubusercontent.com/agnoster/3712874/raw/c3107c06c04fb42b0ca27b0a81b15854819969c6/agnoster.zsh-
theme)

powerline theme on github - [https://github.com/banga/powerline-
shell](https://github.com/banga/powerline-shell)

