Experimental IRC log happs-2007-07-31

Available formats: content-negotiated html turtle (see SIOC for the vocabulary)

Back to channel and daily index: content-negotiated html turtle

These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.

14:44:26<dinoMI_>Hello, happsers.
15:01:45<dinoMI>Well, maybe we can show our shit first or something, since you have to get out of here.
15:01:51<dinoMI>Becuase this is sounding like a late night now.
15:04:40<dinoMI>What's our "status" right now?
21:04:42<dinoMI>I'm working on something with happs. We've got a Data.Map.Map instanced into Serialize but I'm having trouble understanding how to use it in a stateful manner.
21:04:59<dinoMI>Specifically, I'm looking at the tutorial example from section 3.3 Getting from a POST'd value
21:07:08<Saizan>what do you have in this Map?
21:07:54<dinoMI>Saizan: It will be a (Map String String)
21:08:43<Saizan>well, you know anything about the state monad?
21:08:45<dinoMI>Maybe we should have done a MyState like that example and put a map in there. Not sure.
21:09:05<dinoMI>A little. I understand that's what the get/put are for in the main below.
21:09:15<Saizan>exactly
21:09:44<Saizan>the monad carries the state around for you, and you can fetch if with get and store a new one with put
21:09:50<dinoMI>But this example looks like the Int is being statefully stored, not the (MyState Int)
21:10:13<Saizan>why?
21:10:22<dinoMI>do (MySt val) <- get;
21:10:28<dinoMI>Oh, nm
21:10:34<dinoMI>That's merely a pattern match
21:10:35<dinoMI>sorry
21:10:45<Saizan>exactly
21:10:50<dinoMI>NOT a construction
21:11:05<Saizan>no, more like a destruction, if anything
21:11:09<dinoMI>ok
21:11:42<dinoMI>So, in the next line, how id newVal being constructed?
21:11:46<dinoMI>s/id/is/
21:12:03<dinoMI>It's that FromMessage impl isn't it?
21:12:08<Saizan>yes
21:12:50<dinoMI>I wonder if we're approaching this wrong then. We want a Map of stuff to be sitting around. The GET request will ask for a specific key.
21:13:08<dinoMI>So, I can't really make a whole Map from the message of a rq,.
21:13:21<dinoMI>The whole Map represents all of the data we have, the "database"
21:13:37<Saizan>well that's not a problem, you don't need to have an instance of FromMessage for your state
21:13:55<dinoMI>I see, but we do want to unpack the message to get our key to be looked up.
21:14:33<Saizan>well, you can make a Key type if you want
21:15:10<Saizan>so you can write the unpack code in a FromMessage instance
21:15:26<Saizan>or you can use the look* functions on the Request in your handlers
21:15:53<dinoMI>I see. You helped us last week with that with the POST data.
21:17:58<Saizan>uhm yeah
21:18:11<msouth>dinoMI: fromMessage is just how we get info from the user
21:21:11<dinoMI>msouth: btw, your power cord is here in my cube. I got tired of the high desk, it's breaking my neck with shitty posture.
21:21:18<dinoMI>s/desk/table/
21:21:43<dinoMI>laptops are cute and all, but tough on old guys like myself
21:23:01<msouth>dinoMI: looking at hpaste again, it looks to me like the modification of state is done with something called withPastes ?
21:23:58<msouth>and I don't see that defined anywhere, I was wondering if it were somehow autogenerated.
21:24:24<Saizan>withPastes is a function generated by TH, this kind of functions are useful when your state is a record type with many fields and you want to work only on one of them
21:25:19<Saizan>it's genetared with $(inferRecordUpdaters ''YourState)
21:25:19<msouth>is that created because of the $(inferRecordUpdaters ''PasteState) line?
21:25:28<Saizan>yep :)
21:26:59<Saizan>this way you don't have to modify code when you extend your state (serialization would probably break though)
21:27:21<dinoMI>This can't be accomplished with record-style data types?
21:27:21<Saizan>s/code/old code/
21:27:45<Saizan>it builds up on record-style
21:27:51<dinoMI>I see.
21:28:09<dinoMI>I have no experience with TH stuff yet.
21:29:16<dinoMI>But if I have a data Foo = Foo { bar :: Int } and then later on I make it ... { bar :: Int, baz :: String }, that wouldn't break anything that calls foo right?
21:29:23<dinoMI>Sorry bar
21:29:37<dinoMI>Just the mere addition of baz, doesn't break the existing code.
21:30:43<Saizan>yeah, if you've always used record syntax
21:31:00<dinoMI>As opposed to pattern matching, ok.
21:31:50<Saizan>but withBar would give you typecheked guarantee that the code you pass to it deals only with the bar field
21:33:14<Saizan>well, almost, on the type only knows about Int, you've to trust the implementation to use the field corrisponding to the name if you have other fields with the same type
21:37:26<dinoMI>Saizan: Ok. Thank you.
21:41:26<dinoMI>Saizan: It may have been tuukkah who gave us some example code to help last week, I don't really remember. But you guys have all been terrific. Thanks.
21:42:40<Saizan>heh, it's part of the spirit of the #haskell community :)

Back to channel and daily index: content-negotiated html turtle