« Giving XMMS the "what for" with Perl (AKA, C developers, append to enums, don't insert) | Main | Headphone Amps. Audio Hardware You Didn't Know You Needed »

What the Haskell!?

I know I said my next directory recurser would be in Ruby, but Haskell has drawn my attention in a big way. Here's what I came up with...

module Main     where

import IO
import System
import Directory

main = do
  [recDir] <- getArgs
  printDirectory recDir

printDirectory path = do
  putStrLn path
  contents <- getDirectoryContents path
  mapM_ (\f -> do
      let newPath = (path ++ "/" ++ f)
      isaDir <- doesDirectoryExist newPath
      if isaDir
           then printDirectory newPath
           else putStrLn newPath
      ) (drop 2 contents)

Haskell seems like a pretty sweet language that I can learn a lot from. The pattern matching is very sweet and I'm looking forward to having a good understanding of Monads.

Posted by Casey Williams on January 16, 2007 9:14 PM | Permalink

Comments (1)

FreeStoring:

hay!!
good project :)
senks :)

Posted by FreeStoring | December 11, 2007 5:26 PM

Posted on December 11, 2007 17:26

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Search


About

This page contains a single entry from the blog posted on January 16, 2007 9:14 PM.

The previous post in this blog was Giving XMMS the "what for" with Perl (AKA, C developers, append to enums, don't insert).

The next post in this blog is Headphone Amps. Audio Hardware You Didn't Know You Needed.

Many more can be found on the main index page or by looking through the archives.

Subscribe to this blog's feed
[What is this?]
Powered by
Movable Type 4.2rc5-en
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.