Haskell Hacking: a journal of Haskell programming

Haskell Hacking has moved => Go here.
2006-09-22

Haskell for Unix

Today a small tutorial for beginner Haskell programmers, wondering what to do with the language. We implement a range of common unix tools as Haskell one liners, using a "just show me the code" philosophy. The examples should help give a flavour of the beauty and expressiveness of Haskell programming. Here's a preview of complete programs:

-- The 'cat' program
cat     = input id

-- Sort a file
srt     = input sort

-- Reverse a file (tac)
tac     = input reverse

-- remove duplicate lines from a file (like uniq)
uniq    = input nub

Read the tutorial.

/home :: /haskell :: permalink :: rss

About

Real World Haskell

RWH Book Cover

Archives

Recommended

Blog Roll

Syndicate