On Wed, 2007-12-19 at 02:45 +0100, Daniel Fischer wrote:
I believe instead of return $ foldr... you should use
evalStateT $ foldM (flip buildTree) Map.empty entries
This seems to have done it:
evalStateT $ (foldM (flip buildTree) Map.empty entries)) Map.empty
(the second argument to
On Dec 19, 2007 11:28 AM, Andre Nathan [EMAIL PROTECTED] wrote:
I guess I could do away with StateT and just pass the PsMap around as a
parameter, but I guess that wouldn't be the haskell way...
I wouldn't say that. Manual state-passing is a perfectly legitimate
technique, and can be clearer in
Andre Nathan wrote:
I think my code is a bit too long and that probably makes it hard for
someone to help... Does anyone know of good example code using StateT
for keeping a global state other than the one at the Simple StateT use
page on the wiki?
The one I have used is All About Monads:
On Wed, 2007-12-19 at 17:54 -0600, Tommy McGuire wrote:
(Note: I haven't gotten to it in the revisions following the comments I
received here and there are many things that need work. The notes are
incoherent, it's more Pascallish than Haskell, and there are no
guarantees that it won't
Hello
On Mon, 2007-12-17 at 21:22 -0200, Andre Nathan wrote:
Thanks everyone for the great suggestions. The code is much cleaner now
(not to mention it works :)
I'm trying to finish the process tree construction but I guess I'll need
some help again.
My idea is to have a function that would
On Tue, 2007-12-18 at 16:47 -0200, Andre Nathan wrote:
I'm trying to finish the process tree construction but I guess I'll need
some help again.
I guess I could do away with StateT and just pass the PsMap around as a
parameter, but I guess that wouldn't be the haskell way...
I think my code is
Am Dienstag, 18. Dezember 2007 19:47 schrieb Andre Nathan:
Hello
On Mon, 2007-12-17 at 21:22 -0200, Andre Nathan wrote:
Thanks everyone for the great suggestions. The code is much cleaner now
(not to mention it works :)
I'm trying to finish the process tree construction but I guess I'll
Hello (Newbie question ahead :)
I'm trying to write a program which will build a tree (here represented
as a Map) of unix processes. The tree should be built by reading the
process information stored in /proc/PID/status. There is also another
Map which will be used for faster insertions on the
On Dec 17, 2007, at 14:33 , Andre Nathan wrote:
insertProc :: Pid - StateT PsMap IO PsInfo
insertProc pid = do
proc - procInfo pid -- XXX this is obviously wrong...
proc - lift $ procInfo pid
psMap - get
put (Map.insert pid proc psMap)
modify (Map.insert pid proc) -- same as
This is what I have so far:
type Pid = FilePath
type Uid = String
type PsData = Map String Uid
type PsChildren = Map Pid PsInfo
data PsInfo = PsInfo PsData PsChildren
type PsMap = Map Pid PsInfo
type PsTree = Map Pid PsInfo
parent :: PsData - Pid
parent psData =
On Dec 17, 2007, at 15:41 , Brent Yorgey wrote:
Yes, and in fact, you don't even need foldM. The only thing that
actually uses IO is the readFile, so ideally
Actually, a quick check indicates that the regex functions used in
getProcInfo are in IO as well (?!).
--
brandon s. allbery
On Mon, 17 Dec 2007 16:04:24 -0500
Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On Dec 17, 2007, at 15:41 , Brent Yorgey wrote:
Yes, and in fact, you don't even need foldM. The only thing that
actually uses IO is the readFile, so ideally
Actually, a quick check indicates that
On Dec 17, 2007 1:04 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On Dec 17, 2007, at 15:41 , Brent Yorgey wrote:
Yes, and in fact, you don't even need foldM. The only thing that
actually uses IO is the readFile, so ideally
Actually, a quick check indicates that the regex
On Mon, 2007-12-17 at 17:33 -0200, Andre Nathan wrote:
Hello (Newbie question ahead :)
Thanks everyone for the great suggestions. The code is much cleaner now
(not to mention it works :)
This is the first non-tutorial program I'm writing and all this monad
stuff is easier than I thought it
On Mon, 2007-12-17 at 21:22 -0200, Andre Nathan wrote:
On Mon, 2007-12-17 at 17:33 -0200, Andre Nathan wrote:
Hello (Newbie question ahead :)
Thanks everyone for the great suggestions. The code is much cleaner now
(not to mention it works :)
This is the first non-tutorial program I'm
On Mon, 2007-12-17 at 17:56 -0600, Derek Elkins wrote:
Have you read Wadler's papers?
Yeah, I read the two you mentioned. While I can't say I've already
understood 100% of them, I completely agree with you in that they're the
best texts on monads, from what I've seen (maybe because they explain
16 matches
Mail list logo