Re: [Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread jeff p
Hello, I think that whole "program flow" thing is something you get used to. In true, pure functional programming (i.e. Haskell) "program flow" is a meaningless term, basically. Haskell is a declarative language, not an imperative one. You have to learn to give up that control and trust the r

Re: [Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread Michael T. Richter
On Mon, 2007-29-01 at 20:14 +0100, Michael Roth wrote: > Ok, the tool written in Haskell works. But, to me, the source doesn't > look very nice and even it is larger than the ruby solution, and more > imporant, the programm flow feels (at least to me) not very clear. I am by no means a Haskell (

Re: [Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread David Roundy
On Mon, Jan 29, 2007 at 05:30:41PM -0600, Eric Mertens wrote: > import Control.Monad (liftM, forM_) > import Directory (getModificationTime, renameFile) > import Text.Printf (printf) > import System.FilePath ((),(<.>)) > import System.Locale (defaultTimeLocale) > import System.Path.Glob (glob) > im

Re: [Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread Eric Mertens
-- here was my original before I allowed someone (no names) to mangle mine for me ;) import Control.Monad (liftM, forM_) import Directory (getModificationTime, renameFile) import Text.Printf (printf) import System.FilePath ((),(<.>)) import System.Locale (defaultTimeLocale) import System.Path.Glo

Re: [Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread Eric Mertens
-- Here's my contribution to the "Haskell" way to do it import Directory (renameFile) import System.FilePath import System.Path.Glob (glob) import System.Time basenames= [ "mail.log", "thttpd.log" ] logdir = "/var/log" archivedir = "/var/log/archive" main = forM_ bases $ \base -> do

Re: [Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread David Roundy
On Mon, Jan 29, 2007 at 08:14:55PM +0100, Michael Roth wrote: > Hello list, Hi! Just to simplify one function... > logdir = "/var/log" ... > makeOldname :: String -> String > makeOldname fn = logdir ++ '/' : fn ... > main :: IO () > main = do > files <- liftM (filter isLogfile) (getDirect

[Haskell-cafe] How to write elegant Haskell programms? (long posting)

2007-01-29 Thread Michael Roth
Hello list, I'm new to Haskell and I'm trying to learn how to write elegant code using Haskell. I decided to convert the following small tool, written in ruby: === #! /usr/bin/env ruby require 'pathname' BASENAMES = %w{ mail.log tht