Settings

Theme

FuncShell – A Haskell-based alternative to awk

github.com

141 points by _iostreamer_ 9 years ago · 41 comments

Reader

jaytaylor 9 years ago

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

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

tyingq 9 years ago

Similar idea, but uses sqlite to make an awk like utility with sql syntax: https://github.com/dbohdan/sqawk

rnhmjoj 9 years ago

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

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

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

heinrichhartman 9 years ago

Similar idea, but uses LUA as inline language: https://github.com/HeinrichHartmann/luawk

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

Abc ```

omaranto 9 years ago

Similar tools that use Python as the query language:

- The Pyed Piper: https://code.google.com/archive/p/pyp/

- Puffin: https://github.com/kespindler/puffin

gregwebs 9 years ago

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
baldfat 9 years ago

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 9 years ago

    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 9 years ago

      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 9 years ago

        I used sharelatex.

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

        • Jach 9 years ago

          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 9 years ago

            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 9 years ago

              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.

            • Jach 9 years ago

              34 renders fine in LaTeX, in Markdown when you then do 28 it's oh-no. (See this and many other HN comments.)

codewithcheese 9 years ago

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_OP 9 years ago

    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 9 years ago

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

  • _iostreamer_OP 9 years ago

    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 9 years ago

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

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection