Hello Steve,
Monday, December 19, 2005, 10:42:19 PM, you wrote:
SH What I'm after is something like:
SH -- (psuedo-code)
SH [(b,c,d) |
SHb - getDirectoryContents a_dir,
SHc - getDirectoryContents (a_dir ++ / ++ b),
SHd - getDirectoryContents (a_dir ++ / ++ b
[reposted from haskell mailing list where I got no bites :) ]
Folks,
I'm new to using monads, and I'd like some help improving a function
definition that I wrote and which works, but for which I think there
should be a clearer way to write it.
What I'm after is something like:
-- (psuedo-code)
Okay...that works. Sweet.
gdc x = ListT $ getDirectoryContents x
get3levels top = runListT $ do
b - gdc top
c - gdc $ top++('/':b)
d - gdc $ top++('/':b)++('/':c)
return (b,c,d)
I feel bound to point out http://haskell.org/hawiki/ListTDoneRight which
has more to say about the details
On 12/19/05, Chris Kuklewicz [EMAIL PROTECTED] wrote:
Okay...that works. Sweet.
gdc x = ListT $ getDirectoryContents x
get3levels top = runListT $ do
b - gdc top
c - gdc $ top++('/':b)
d - gdc $ top++('/':b)++('/':c)
return (b,c,d)
Yeah, that's awesome: just as readable as the