09:52:01 <kstt> hello ...
09:52:20 <HugoDaniel> hey kstt
09:52:25 <mekeor> hi
09:52:38 <kstt> hi HugoDaniel, hi mekeor
09:52:59 <kstt> routing question : do we *really* have to provide a fromReqUri instance to route on a path segment ?
09:54:10 <kstt> I was looking for a popPath :: (MonadPlus m, ServerMonad m) => (String -> m b) -> m b
09:54:40 <kstt> or maybe is String a predefined instance ... I realize I may have missed the point of the path combinator
09:55:05 <mekeor> yea, AFAIK String is an instance.
09:55:14 <mekeor> just add a type signature…
09:55:31 <kstt> ah, ok, I should have watched more closely the definition of fromReqUri
09:55:34 <kstt> thank you :)
09:57:27 <mekeor> i'm not sure though. i'm a noob!
09:57:55 <donri> or let it be inferred if you use it as a string, unambiguously
09:58:49 <kstt> indeed
11:07:11 <kstt> what is the prefered form of transformer for ServerPartT please ?
11:08:11 <kstt> "ReaderT ReqContext (ServerPartT IO)"  or  "ServerPartT (ReaderT ReqContext IO)"
11:27:10 <donri> kstt: the latter, when possible
11:27:24 <donri> you'll need mapServerPartT or simpleHTTP' to run the inner reader
11:27:49 <kstt> I will go with the latter then
11:27:52 <kstt> thx
11:28:27 <donri> but your type will still be a ServerPartT so it'll provide less surprises with lacking instances for e.g. hsp if you use that
11:31:48 <donri> even if you newtype you can derive instances from the serverpart type
11:33:17 <donri> actually i think the missing instances was fixed in some release... not sure
11:33:20 <donri> stepcut?
13:23:26 <kstt> query :: QueryEvent event => AcidState (EventState event) -> event -> IO (EventResult event)
13:24:08 <kstt> therefore, "foo <- query myAcid myEvent" will get me a "EventResult event"
13:24:35 <kstt> how are we supposed to manipulate this "EventResult event" ?
13:28:03 <Lemmih> That depends on what it is.
13:28:33 <kstt> hi Lemmih !
13:28:41 <Lemmih> The concrete type of 'EventResult event' depends on the type of 'event'.
13:29:07 <kstt> glad to have you around, I'm working with your package
13:29:56 <kstt> that's advanced type system tricks, right ?
13:30:25 <Lemmih> Yeah.
13:31:52 <kstt>  I have a :  Couldn't match type `MethodResult (Query SormiouState RenderState)'
13:31:52 <kstt>                    with `RenderState'
13:31:52 <kstt>     Expected type: RenderState
13:31:52 <kstt>       Actual type: EventResult (Query SormiouState RenderState)
13:31:55 <kstt>  
13:32:15 <kstt> ah ah ah sorry
13:32:23 <Lemmih> You probably did 'query myAcid myEvent' instead of 'query myAcid MyEvent'.
13:32:30 <kstt> exactly
13:32:35 <kstt> I messed up the case
13:32:44 <kstt> makes more sens now
13:32:54 <kstt> thank you
13:33:07 <Lemmih> np
13:34:58 <kstt> also, my application type is ServerPartT (ReaderT ReqContext IO). The ReqContext is a record with much stuff in it, including the acid handle. Should I use query or query' ?
13:36:10 <Lemmih> query' is just query+liftIO.
13:36:29 <kstt> ok
13:36:31 <kstt> indeed
13:36:58 <Lemmih> If you find yourself doing 'liftIO $ query ...' a lot then query' can save you a few keystrokes.
13:38:23 <kstt> ok, thank you. I think i'm going to declare a custom query encapsulating the access to the acid handle
13:38:36 <kstt> so liftIO won't cause RSI :)
13:42:13 <kstt> but that does not seem so easy ...
13:42:54 <kstt> Could not deduce (MethodState event ~ MethodState SormiouState)
13:42:54 <kstt>     from the context (QueryEvent event) bound by the type signature for
13:42:54 <kstt>                  sormiouQuery :: QueryEvent event => event -> App (EventResult event)
13:42:54 <kstt>  
13:45:27 <Lemmih> Yeah, you need to specify the state as well.
13:45:32 <Lemmih> The type of the state.
13:46:25 <Lemmih> The type you have says 'Any query event can be run in the App monad'.
13:46:48 <kstt> ok
13:46:57 <Lemmih> You need it to say 'Query events over the SormiouState can be run in the App monad.'
13:47:02 <kstt> (that's a bit advanced for me)
13:47:24 <kstt> fine
13:47:39 <Lemmih> somiouQuery :: (QueryEvent event, EventState event ~ SormiouState) => ...
13:47:54 <kstt> mmh ... never used the ~
13:48:15 <kstt> could you recommand me some readings on it please ?
13:49:38 <Lemmih> Search for type families and equality constraints.
13:51:24 <kstt> ok, thank you
14:52:53 <kstt> Lemmih, still here ? I'm still quiet confused with type families and acid-state. What is the canonical way to query the whole state of the handle please ?
14:53:15 <kstt> I realize that it make very little sens in my case to have multiple Query
14:53:56 <kstt> a single one to the THE state, associated with Lens accessors, is more composable
14:54:30 <kstt> I tried implementing "getState :: App State" but failed for reasons similar to the attempt above
14:57:03 <hpaste> kstt pasted “acid state id” at http://hpaste.org/69379
14:57:32 <kstt> should I really make an acidic Id to read the content ?
14:59:55 <kstt> yeah, I guess I must
15:04:08 <Lemmih> Yes.
15:04:28 <Lemmih> askState :: Query State State; askState = ask
15:05:37 <Lemmih> Just remember that such a query will be expensive to run if the state is on a different machine.
15:07:03 <kstt> Sure, this is not planned for the forseable future
15:07:34 <kstt> If I can make a suggestion, this could be in the lib :)
15:08:40 <Lemmih> What could?
15:23:23 <kstt> askState or so
15:23:54 <kstt> any simple way to get the whole state out of the acid handle
15:30:02 <Lemmih> kstt: Oh no, can't do that.
15:30:22 <kstt> can't technically ? or can't morally ? :)
15:31:13 <Lemmih> Most people don't care about scalability so I have to care about it for them.
15:31:39 <kstt> ok
15:31:49 <kstt> thank you dad :)
15:31:55 <Lemmih> It's a bit like children who don't want to brush their teeth.
15:31:59 <Lemmih> :D
15:32:14 <Lemmih> One day you'll thank me. (:
15:32:17 <kstt> I'm sure one day I'll realize
15:33:08 <kstt> I just hope that this day won't come too late, because I'm pretty sure I'm older than you :D
16:57:48 <stepkut> kstt: http://www.happstack.com/docs/crashcourse/AcidState.html#acid-state-advanced
16:58:14 <stepkut> kstt: that shows one way to implement a 'query' function that automatically pulls the acid-state handle from ReaderT
17:35:44 <stepcut> Lemmih: so.. if you call 'createCheckpoint' several times in a row, and don't have much data, you might expect to find a single checkpoint file that contains multiple checkpoints ?
17:36:07 <stepcut> Lemmih: since the event and checkpoint files are both written using the same logging code?
18:01:08 <Lemmih> stepcut: Yeah.
18:01:19 <stepcut> k
18:01:33 <stepcut> trying to track down a problem where the checkpoint files can't be read in after the server is shutdown
18:02:12 <stepcut> gets an error like:  artvaluereport: Could not parse saved checkpoint from /srv/artvaluereport-production/artvaluereport-state/accounts/checkpoints-0000000071.log due to the following error: Failed reading: safecopy: Char: Cannot find getter associated with this version number: Version {unVersion = 1634890341}
18:02:23 <stepcut> which is pretty opaque
18:03:10 <stepcut> currently it looks like all the involved SafeCopy instances are created using deriveSafeCopy.. so, there is not just an obviously bad SafeCopy instance
18:15:38 <stepcut> oh .. no I take that back
18:15:42 <stepcut> found the right copy of the code
18:31:45 <stepcut> ok, looks like my problem would due to a badly written SafeCopy instance (not confirmed yet). Would be nice if safecopy had something like boomerang where your parser/printer can be specified at the same time
18:56:02 <Lemmih> stepcut: Yeah.
18:56:26 <Lemmih> stepcut: I use QuickCheck to verify that the SafeCopy instances make sense.
19:08:47 <stepcut> yeah, I had to do that with web-routes before I wrote boomerang
19:10:07 <stepcut> not sure how to get better debug information into the error messages yet
19:11:33 <stepcut> also not clear on how to create a valid backup either :-/
19:13:46 <Lemmih> I feel pretty safe with SafeCopy + revision control.
19:14:57 <stepcut> how do you actually do a backup of the running server state though ?
19:16:12 <Lemmih> checkpoint+archive.
19:17:23 <stepcut> so your backup program has to initiate the checkpoint+archive and know when the archive directory is ready?
19:18:09 <stepcut> or do you have the server itself initiate the backup?
19:18:35 <donri> needs moar replication
19:18:42 <stepcut> indeed
19:19:25 <Lemmih> stepcut: My setup is simple. Checkpoint+archive+rsync.
19:20:05 <stepcut> Lemmih: right. We use rsync as well.. but the rsync is initiated by the remote machine that the backup is stored on
19:20:43 <stepcut> Lemmih: so there needs to be some coordination in terms of making sure the checkpoint + archive has completed first..
19:20:57 <Lemmih> Well, not really.
19:21:13 <stepcut> oh ?
19:21:35 <Lemmih> This method doesn't guarantee that you won't lose data. Bad rsync timing just means you might lose a bit more data.
19:21:43 <stepcut> yes
19:22:09 <stepcut> the rsync method can only limit things up to a point, beyond that you need replication
19:23:41 <stepcut> currently nothing is triggering a checkpoint+archive though.. so.. my thought is that the backup script needs to connect to some URL on the server, authenticate itself, and perhaps the checkpoint+archive. Then when that returns, do the rsync
19:24:11 <stepcut> or, maybe even the double-checkpoint + archive
19:24:38 <stepcut> so that in many cases the most recent thing in the archive will be a checkpoint file
19:25:37 <stepcut> making it easier to import an old backup, assuming you modify your event types
19:32:52 <Lemmih> You can use SSH for authentication.
19:40:58 <stepcut> you mean, ssh into the remote host and issue the command to the server over a unixsocket or something?
19:46:43 <Lemmih> Configure the server to accept maintenance commands from localhost.