--- Log opened Fri Jun 26 00:00:30 2009
00:27 < ac> anybody else checked out his blog example?
00:28 < tommd> Link?
00:28 < ac> http://softwaresimply.blogspot.com/
03:16 < tibbe_> mae: sorry for running out of you yesterday
03:16 < tibbe_> had to run
06:21 < jpcooper> hello
06:21 < jpcooper> could someone tell me where is the documentation for happs?
06:26 < ac> jpcooper: http://happstack.com/docs/0.2/happstack-server/0.2/
06:26 < jpcooper> thank you
06:27 < ac> there's also a tutorial at happstack.com, and there are various examples out there on the Internet
06:28 < jpcooper> okay
06:28 < jpcooper> I was looking at another site
06:28 < ac> jpcooper: when you install it, do a cabal update first, because it's been updated recently
06:29 < ac> jpcooper: also, once you've figured everything out, please explain it all to me
10:24 < mightybyte> ac: I'm here now.
13:47 < jpcooper> is there any purpose of happs.org at the moment?
13:48 < jpcooper> I was redirected to it from google and was under the impression that there was no decent documentation for happs until I came across happstack.com
13:48 < jmcarthur_work> it's completely unmaintained afaik
13:49 < jpcooper> I didn't know that happstack existed
13:49 < jmcarthur_work> :(
13:49 < jpcooper> it might be helpful for there to be a link or something
13:50 < jpcooper> also happstutorial.com doesn't work
13:51 < jmcarthur_work> oh that's new to me
13:51 < jmcarthur_work> tutorial.happstack.com fails too
13:52 < jmcarthur_work> i promise happstack is very much alive and well
13:52 < jpcooper> yeah
13:52 < jpcooper> that's good
15:54 < ac> mightybyte: how about now?
16:07 < ac> I'm not clear at all on what should make a component
16:10 < ac> I'm creating a data model that contains users (a struct), all users (IntMap User), groups (probably IntMap ()), all groups, and some way to attach one or more groups to users
16:10 < ac> s/struct/record/ :-P
16:10 < ac> I assume User and Group should each be components
16:23 < ac> mightybyte: I had a question about youl blog demo. It's listening on port 8000, but it won't respond to requests
16:29 < Kamil> IntMap ()?
16:29 < Kamil> is that for single group?
16:30 < TomMD> moving over from #haskell: where's the happs tutorial these days?  The Haskell.org wiki ones are old and http://happstutorial.com/ is down.
16:30 < Kamil> tutorial.happstack.com?
16:30 < mightybyte> ac: I'm here
16:31 < TomMD> kamil: That doesn't work for me.
16:31 < Kamil> ah, it used to be there
16:31 < TomMD> I think a server is just down.
16:31 < Kamil> you can get it from patch-tag and run offline
16:33 < ac> Kamil: yeah, a group is just [Int], but IntMap () would be better for determining if a specific user ID was in there
16:33 < mightybyte> ac: Are you making requests from the same computer?
16:33 < ac> mightybyte: yeah
16:33 < ac> mightybyte: which works with the other happstack examples
16:34 < mightybyte> Hmmm
16:35 < mightybyte> Did you get the code from hpaste?
16:35 < ac> mightybyte: curious. I'm getting responses with netcat, but not firefox
16:35 < ac> mightybyte: I pasted it from the blog post
16:36 < mightybyte> Ok.  I assume you filtered it through s/HAppS/Happstack/  ?
16:37 < ac> mightybyte: "HAppS" doesn't appear in the code
16:37 < mightybyte> Which post did you copy from?
16:38 < ac> ARHG
16:38 < ac> typed the wrong URL in Firefox
16:38 < mightybyte> I'm looking at "Finished HAppS Application" and it has import HAppS...
16:38 < ac> mightybyte: "Basic Happstack Blog App", posted April 7 2009
16:39 < mightybyte> Ahh, ok
16:41 < ac> mightybyte: you should link to new_post.html somewhere in that code
16:44 < mightybyte> It's in the happstack-auth github repo.
16:44 < mightybyte> But yeah, I should make a link.
16:44 < mightybyte> It seems to work for me.
16:44 < ac> it works for me too. I was being retarded
16:45 < mightybyte> Oh, ok.e
16:45 < ac> bloody firefox stuck ".com" after localhost, which explained why netcat worked, but FF did not :-| (embarrassed face)
16:47 < mightybyte> Oh, heh.
16:47 < ac> so do you have any input on what types should be components?
16:48 < mightybyte> There, I added a link.
16:48 < mightybyte> Well, the same thing I said yesterday. :)  Anything that needs to be transactional.
16:49 < mightybyte> ...which is both a really good and a really bad answer at the same time.
16:49 < mightybyte> I don't understand the difference between "users" and "all users" in your description above.
16:50 < ac> I have a User record with stuff like username, password, etc, and a collection of users which would be a "Map UserId User" or just "IntMap User"
16:51 < mightybyte> "users" = "data User = User ...", and "all users" = "type UserDB = IntMap User"?
16:51 < ac> yeah
16:51 < mightybyte> Ok
16:51 < ac> should they both be components?
16:51 < ac> or just UserDB?
16:51 < mightybyte> No, User would not be a component.  Just UserDB
16:51 < ac> I see, because you never do a transaction on a USer
16:52 < mightybyte> I personally like using IxSet for this type of thing, but IntMap should work fine too.
16:52 < mightybyte> Right.
16:52 < ac> you wouldn't need to update one part of the User record depending on another part of it concurrently
16:52 < ac> oh yeah, I forgot about IxSet. That is what it's for
16:52 < mightybyte> It's pretty slick once you get used to it.
16:53 < mightybyte> Saves you the work of creating a new map every time you want a new index.
16:53  * ac throws years of RDBMS and LAMP experience out the window ;)
16:53 < mightybyte> IxSet can be thought of as a RDB table.
16:55 < mightybyte> data User = User {id :: Word64, name :: String, age :: Int}
16:55 < ac> why not Int64?
16:55 < mightybyte> $(inferIxSet "UserDB" ''User 'noCalcs [''Word64, ''String])
16:55 < ac> Word64 is like unsigned Int?
16:55 < mightybyte> Doesn't really matter.
16:56 < ac> what if there's more than one Word64 or String type? How does it decide which to make indexes on?
16:56 < mightybyte> Oh, but actually...if you're going to do that, I would recommend making newtypes for all your indexes.
16:57 < mightybyte> ...which answers your last question.
16:57 < ac> ah. That's weird
16:57 < ac> you should pass it the record names, not their types
16:57 < mightybyte> Yeah, well...
16:57 < mightybyte> I'm not yet familiar with the TH code that implements that.
16:58 < mightybyte> But making newtypes is very important.
16:58 < mightybyte> It's bitten me several times.
16:58 < ac> huh. I don't understand the proliferation of newtypes in a lot of Haskell code. I haven't been writing Haskell long enough I guess
16:59 < mightybyte> If you used "data User = User {id :: UserId, name :: Username, age :: Age}"
16:59 < mightybyte> And then you had udb :: UserDB
16:59 < mightybyte> udb @= "joe" would return zero results
17:00 < mightybyte> You'd have to use: udb @= (Username "joe")
17:00 < ac> ah, that's convenient
17:00 < mightybyte> BUT
17:01 < mightybyte> Let's say User had another item, bio :: Bio
17:01 < mightybyte> And then you have data Bio = Bio {text :: string, date :: Word64, foo :: Foo, ...}
17:02 < mightybyte> And let's say your name wasn't of type Username, but it was a String.
17:03 < mightybyte> Then 'udb @= "joe"' would also return Users that had the string "joe" in their Bio text.
17:03 < ac> even though Bio isn't of type String?
17:03 < mightybyte> No no, Bio contains something of type String.
17:04 < ac> what does @= do then?
17:04 < mightybyte> It traverses the type hierarchy.
17:04 < mightybyte> db @= val is like select * from db where field = val
17:05 < mightybyte> Except field can be any field matching the type of val.
17:05 < ac> interesting
17:05 < mightybyte> Even fields below the first level of the type hierarchy.
17:05 < mightybyte> THAT is why you want to use newtypes
17:05 < ac> yes, I see
17:06 < ac> thanks, that saved me a lot of headache
17:06 < mightybyte> Otherwise your queries may return things you didn't expect.
17:06 < mightybyte> Just don't forget it.  It's bitten me at least twice.
17:07 < ac> man I'm not looking forward to implementing this group bullshit. I wonder if there's a better way to do this
17:07 < mightybyte> data Group = Group [User]
17:07 < mightybyte> or UserId
17:08 < mightybyte> Although that's probably not good enough
17:08 < ac> I guess I should even make newtypes for different Ids, definitely if there are two Id fields in one record
17:08 < mightybyte> data Group = Group {gid :: GroupId, users :: [UserId]}, and then put it into an IxSet.
17:09 < mightybyte> Yep
17:09 < ac> Yeah, that's super simple
17:09 < ac> the part I'm not looking forward to is the permissions thing
17:10 < mightybyte> Ahhh
17:10 < mightybyte> I actually may be implementing something similar soon.
17:14 < mightybyte> This is an interesting TH function in Happstack that may be promising.
17:14 < mightybyte> http://happstack.com/docs/0.2/happstack-state/0.2/Happstack-State.html#v%3AinferRecordUpdaters
17:14 < mightybyte> Though I haven't used it.
17:15 < ac> cool
17:31 < Oejet> Hi, I am trying out the sample Happstack app: "sh bin/run.sh", but that gives me this error: "trhsx: Error at SrcLoc {srcFilename = "src/GuestBook/View.hs", srcLine = 34, srcColumn = 1}: Illegal instance declaration".
17:38 < Oejet> Versions used: happstack 0.3.2, ghc 6.10.1.
17:43 < ac> Oejet: that error is in code you wrote it looks like
17:45 < ac> Oejet: hpaste the code that's broken?
17:48 < Oejet> ac: I did not change anything after "happstack new project myproject".
17:49 < ac> Oejet: whoa, there's a CLI? (goes to show what I know about happstack)
17:50 < Oejet> There is a GUI?!
17:50 < ac> Oejet: not that I know of
17:50 < ac> Oejet: I thought it was just a library
17:55 < Oejet> I followed the instructions of the blog post for the happstack 0.2 release.
17:57 < Oejet> (http://blog.happstack.com/2009/03/04/happstack-02-released/)
18:06 < Oejet> Perhaps I did not install the dependencies (HSX perhaps) correctly...the installation did not go very smoothly.
--- Log closed Sat Jun 27 00:00:31 2009