03:18:05 stepcut: hmm, when I replace hack-handler-happstack with hack-handler-hyena it no longer stack overflows 03:18:17 :) 03:18:28 something must be wrong in hack-handler-happstack ? 03:21:04 ..but hyena has other problems, by the looks of it 03:21:35 next thing is to try with happstack and no hack. I'm afraid this will be a time sink 03:22:28 would you know a good idiomatic happstack app to look at these days ? 03:22:48 um 03:23:08 not really.. I am working on an idiomatic app -- but it requires patches that are not available yet 03:23:48 alright.. I'll start with the tutorial 03:24:05 there is the thing in happstack/happstack/templates/project 03:24:43 um, can I assume happs-tutorial works with happstack 0.4.1 ? it won't cabal install 03:25:12 ok, thx 03:25:32 I know nothing of happs-tutorial 03:25:39 well, except that it exists 03:26:49 I wonder why I can't browse the templates dir at http://patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack 03:27:28 dunno.. that is odd 03:29:38 http://groups.google.com/group/patch-tag-users/browse_thread/thread/d1d81575abd93816 03:33:09 yes, this is a hassle.. I'll have to make my hsps work with happstack as well. I'd be much better off waiting for your example 03:33:21 maybe I can roll back to my pre-hsp pre-hack code 03:34:09 I just committed a patch to happstack that makes using HSP stuff with happstack better 03:34:20 though it does it by getting rid of the need to use the HSP monad at all 03:34:46 thanks 03:34:53 is that.. bad ? 03:35:01 sounds like a good thing :) 03:35:32 it is a good thing 04:04:56 night stepcut, all 04:05:02 night 15:08:05 how do you deal with request input parameters? 15:10:20 Try withData or withDataFn 15:12:25 I tried 15:13:05 Didn't work? 15:13:09 there is too many code for parameters processing in this way 15:14:38 unfortunately hpaste is down =( 15:16:13 What part of the request do you want? 15:17:52 rqInputs 15:18:32 Try lookInput 15:18:50 ...or one of the other lookXYZ functions. 15:20:38 I get a Maybe value, and i have to unwrap it 15:21:34 What's wrong with that? 15:22:16 maybe it's better to wrap result in Error monad? 15:23:06 Depends on what you are doing. 15:23:21 if i use Error monad in all my handlers it is very convenient to get inputs 15:23:22 Getting a Maybe value is a good thing. It forces you to handle errors. 15:24:29 It essentially eliminates a large class of bugs you'd get in languages like C/C++/Java -- the class of null pointer bugs. 15:25:34 how does it this? 15:26:46 It forces you to handle both cases (Just and Nothing). 15:27:51 but this functions can handle all cases themselves 15:28:02 Which functions? 15:28:04 i mean functions such as look 15:28:52 But the look* family of functions must be used in conjuction with something like the withData* or getData* functions. 15:30:38 withDataFn is just a wrapper around getDataFn that handles errors with mzero. 15:31:50 http://paste.org/pastebin/view/15326 15:32:25 such aproach is more convenient for me 15:32:45 i think it can be written without 'getDataFn' 15:34:31 You've got a lot of repetition there. 15:36:19 strictly, I have 15:38:08 but my handlers code looks like 'getInputStringRead "id" >>= \id -> getInputString "objectname" >>= renameObject id' 15:38:24 *getInputRead of course 15:43:57 mightybyte: what repetitions beside not calling getInputString in getInputRead? 15:48:18 i did some fixes 15:48:37 http://paste.org/pastebin/view/15327 15:53:54 You can use the maybe function instead of case statements on Maybe values. 15:55:31 I don't see how it can be done 15:56:03 The case statement in getInputString can be replaced with the following: 15:56:30 maybe (throwError $ "Parameter " ++ input ++ " not found") return resM 15:59:15 i got it 16:00:19 The Monad instance for Maybe also makes it very convenient to chain operations on Maybe values. 16:02:21 mightybyte: please, show how to combine getting inputs in my example through maybe monad? 16:02:33 getInputStringRead "id" >>= \id -> getInputString "objectname" >>= renameObject id 16:03:28 rdtsc: Well, it depends on your needs. 16:04:04 Maybe allows you to handle failures without repeating cases over and over. 16:04:26 mightybyte: i need to get integer id and name of object and rename it through renameObject function 16:04:27 But the result doesn't give you any indication why the failure happened. 16:04:50 If you need that, then an error monad of some kind is probably better. 16:05:21 it is more important to get automagic processing of all failures rather than printing pretty error messages 16:06:23 Chapter 19 of Real World Haskell talks about this in more detail. 16:06:26 http://book.realworldhaskell.org/read/error-handling.html 16:08:53 i'll read 16:09:25 thanks for advices 16:09:40 No problem. 18:43:56 morning all 18:44:10 do you know of a non-happstack way of doing what waitForTermination does ? 18:44:35 I'd like to not depend on happstack for that 18:45:22 or, is that something that should be added to System.Process ? 18:46:08 I don't see why not. 18:46:15 I'll suggest it 18:46:15 sm: look at it sources 18:46:23 just did, and it looks a bit hairy 18:48:59 version for windows looks terrible 18:51:06 bah, mail to the process maintainer email rejected 18:54:38 but posting via gmane works 18:59:47 rdtsc: no idea what's going on there.. 19:01:05 well, something primitive. O well, perhaps my request will stir up a patch, or an alternate technique 19:03:03 sm: i'm recent visitor here 19:03:18 welcome 19:11:35 sm: I'd use MVars for it 19:11:52 or … hmm 19:11:53 ^^ 19:11:56 yeh 19:12:04 MVars with Control.Exception 19:12:45 http://hpaste.org/fastcgi/hpaste.fcgi/view?id=18963 does look clunky 19:13:14 I think there's a bracket function which could also help 19:14:31 hmm.. I just have not really mastered process control, error management, and the combination of these 19:14:47 http://npaste.de/G2/ 19:14:49 like this 19:14:58 no idea if IOException is what you want… 19:14:59 ^^ 19:15:24 interesting, thanks for the example 19:18:32 no idea if thats how waitForTermination works… been a while since I took a look at the code 19:18:35 :) 19:19:00 actually it seems to be.. http://hackage.haskell.org/packages/archive/happstack-state/0.4.1/doc/html/src/Happstack-State-Control.html#waitForTermination 19:19:36 same principle, anyhow 19:19:48 yeh 19:19:49 :)