News for hackers. Stuff that matters.
Re:Learn a Programming Language Faster by Copying Unix by arocks on Saturday November 03, 2012 @01:27PM (#4737236)
For a purely functional language like Haskell, this would not be a very good advice. Any kind of I/O would involve monads and other imperative constructs. Better implement an algorithm involving trees or graphs to better appreciate a functional language.
Re:Learn a Programming Language Faster by Copying Unix by shangaslammi on Saturday November 03, 2012 @01:46PM (#4737314)
Not at all. You can start doing I/O in Haskell without knowing anything at all about monads by just treating the do-syntax as an imperative DSL.

In fact, Bryan O'Sullivan (who wrote Real World Haskell) just held a tutorial session on Haskell a couple of weeks ago where people completely new to the language implemented simple Unix tools like "wc". I don't think monads were mentioned at all.

Re:Learn a Programming Language Faster by Copying Unix by 4ad on Saturday November 03, 2012 @04:10PM (#4737745)
This only works if you are a top-down thinker. Many people are bottom-up thinkers.
Re:Learn a Programming Language Faster by Copying Unix by anothermachine on Sunday November 04, 2012 @03:25PM (#4740902)
Explain?

With "do" and the coincidental naming of "return", and IORefs if you insist, you can write imperative bottom-up code in Haskell.

Re:Learn a Programming Language Faster by Copying Unix by Hemospectrum on Saturday November 03, 2012 @01:39PM (#4737273)

    main = interact id
This is a slightly crude implementation of cat in Haskell. As you can see, it is replete with scary monad plumbing that gets in the way of the actual functionality (copying stdin to stdout).

I would explain further and implement more than what the blog post suggested but there's already a book (Real World Haskell) that does this with a number of other Unix commands.

Re:Learn a Programming Language Faster by Copying Unix by rodrigoavie on Saturday November 03, 2012 @01:41PM (#4737289)
In the post I only suggested cat and tree for examples. Other nice tools would be: ls, touch, rm, mkdir, rmdir and even cal.

I just made a few more suggestions. I can't count how many neat, small tools are provided by Unix. It's a large ground to play in!

Re:Learn a Programming Language Faster by Copying Unix by scott_s on Saturday November 03, 2012 @08:57PM (#4738482)
On the contrary, any interesting program is going to have to do some I/O. So if you're want to do useful things with a language, I think it's a good thing to learn the basics of opening, reading and writing files.

Also, you should take a look at the top comment in this thread.

Re:Learn a Programming Language Faster by Copying Unix by pjmlp on Saturday November 03, 2012 @02:18PM (#4737424)
Well you could always follow the Unix system programming in OCaml tutorial:

http://ocamlunix.forge.ocamlcore.org/