[Haskell-cafe] Any tips on "doing it right" for a small program?

Bram Neijt bneijt at gmail.com
Mon Aug 11 18:41:42 UTC 2014


Dear reader,

I'm still new to haskell, and decided to convert a simple bash script
to a full-on-bells-and-whistles Haskell program (as a learning
experience). As you might guess I could use some help.

The program is very simple, in Bash it reads:
CMDPATTERN="$@"
while [[ "`pgrep --count --full "$CMDPATTERN"`" -gt 1 ]]; do
    sleep 5
done

AKA: while there is a command running with the given string, loop. I
called this script "after" and use it on the commandline to chain
commands from different terminals.

The Haskell version is available at https://github.com/bneijt/after

What I have done:
- Add Travis CI
- Add a first test case using test-framework
- Add commandline option parsing using "options"
- Implement a fork-join behavior using parallel-io

What I would like help with:
- How to add a --version that reflects the after.cabal version?
- Is there a library for what I'm doing in Process.hs (listing running
processes, etc.)?
- How to add "-p <pid>" support, so I can do "after -p 129 -p 402"
(after both pids)
- Should I move from exitcode-stdio-1.0 to detailed-1.0?
- Any and all other hints you might have

Also if you have projects you want to point to for inspiration, I'd be
happy to take a look.

Greetings,

Bram


More information about the Haskell-Cafe mailing list