09:00:17 <sebastianhohn> hi, someone know how to compile the current darcs checkout on ubuntu?
09:27:10 <sebastianhohn> OK, got it, there seems to be a bug in happstack-server/src/Happstack/Server/SimpleHTTP.hs
09:27:48 <sebastianhohn> Just changed the line 425 from: instance ToMessage Blaze.Html where
09:28:10 <sebastianhohn> to: instance ToMessage (Blaze.Html a) where
09:28:22 <sebastianhohn> sorry, just the other way round.
21:45:33 <t3eblinder> Hello, I'm using happstack with sqlite3 as database and I have some questionswith happstack and haskell. I have many function of the form
21:45:33 <t3eblinder> getUser :: (IConnection conn) => conn -> String -> IO User
21:45:34 <t3eblinder> Can I put my connection	into some state/reader and then getting something like
21:45:34 <t3eblinder> getUser :: String -> m User
21:45:34 <t3eblinder> (getting the connection and lifting the io part in that monad) and then passing this state to simpleHTTP as underlaying monad?
21:45:34 <t3eblinder> (maybe stupid questions, but I'm learning haskell...)
21:47:31 <burp> yes that is possible
21:48:21 <burp> just as you said, putting the connection into a reader/state
21:50:46 <t3eblinder> can you give a small example how to do it? I don't know how it could be done. I've problems with such stuff, and I don't get it...
21:51:03 <burp> ok let's see
21:53:12 <stepcut> I would recommend creating a newtype like, new MyServerPartT conn IO a = ReaderT conn (ServerPartT IO) a deriving (Functor, Monad, MonadIO, Applicative, MonadReader conn, ServerMonad, WebMonad Response, FilterMonad Response)
21:53:34 <stepcut> I can expand on that in a few minutes, but I have some other stuff to do at the moment
21:54:03 <t3eblinder> that would be very nice :-)
21:54:27 <stepcut> I should make it a blog post
21:54:32 <stepcut> because it is a very useful pattern
21:54:37 <stepcut> actually
21:57:55 <stepcut> hmm, I have something similar is this code, http://src.seereason.com/examples/happstack-imageboard/Web.hs (ConfigT, MonadConfig), but I think there is a better way to do it
21:59:04 <t3eblinder> I'll take a look
21:59:57 <stepcut> t3eblinder: in that code I leave everything very abstract, so you would have, getUser :: (MonadConfig conn, ServerMonad m) => String -> m User
22:01:12 <burp> http://paste.railsbox.eu/show/oOb1eL88lpJmp63irGF9/
22:01:17 <burp> something like this you want t3eblinder?
22:01:47 <burp> you can use ServerPartT IO instead of IO as the inner monad of course
22:01:53 <stepcut> but, then you end up with crazy type signatures. For example, look at the type for 'boardTemplate'
22:02:43 <stepcut> burp: I prefer to declare a newtype, and deriving the instances for MonadReader, ServerMonad, etc, so that you don't have to use 'lift' all over the place
22:03:45 <burp> hm ok
22:03:57 <burp> and I also prefer MonadLib
22:04:25 <stepcut> well, happstack is mtl based at the moment, so I am not sure how feasible it is to use monadLib.
22:04:40 <stepcut> We are going to wait until a victor from mtl vs monadLib vs transformers arises
22:04:47 <burp> hehe
22:04:47 <stepcut> I suspect it will be transformers, but I could be wrong
22:05:42 <stepcut> actually, I think it should be possible to do a little hacking so that happstack can use mtl or transformers depend on what cabal flags you use. But someone would have to care enough to submit a patch.
22:10:08 <burp> t3eblinder: also you might try takusen and see if you like it
22:10:37 <t3eblinder> burp: what is takusen?
22:10:53 <burp> database library just like hdbc
22:10:54 <burp> http://hackage.haskell.org/package/Takusen
22:11:16 <burp> but with interesting handling of the results data
22:11:58 <burp> once one gets into it, it's preferrable instead of the hdbc
22:12:39 <burp> basically where hdbc can only return lists, takusen can return anything, the way you specify it
22:13:14 <t3eblinder> burp: I'll keep it in mind, but i stay with my 'database result type' (some kind of maybe but with fail/error type) because i'm try to learn haskell better
22:13:40 <burp> ok
22:14:29 <burp> doQuery (PGSQL.sql "SELECT id,shortcut FROM main_station") mapIteratee Map.empty
22:14:34 <burp> mapIteratee :: (Monad m) => Int -> String -> IterAct m (Map String Int)
22:14:39 <burp> mapIteratee i str acc = result' (Map.insert str i acc)
22:14:47 <burp> this way I get just a Map as the result
22:14:58 <burp> by specifying such an iteratee function
22:15:12 <burp> if you wanted to that with hdbc you had to use the list first, and process it
22:15:24 <burp> in takusen all this is very elegant
22:15:44 <t3eblinder> looks very interesting :)
22:16:12 <stepcut> SQL is dead. Long live happstack-state ;)
22:16:39 <burp> buy me the server to handle it ;P
22:17:38 <stepcut> burp: how big is your dataset ?
22:18:37 <burp> um, for my irc bot it was just a few thousand quotes + other stuff, ~1.5MB checkpoint file
22:18:48 <burp> but as I already mentioned the bot took up to ~150M memory after a while :>
22:19:47 <burp> and for the website I'm working on we have ~500k table entries.
22:19:59 <burp> I think happstack-state couldn't handle this
22:20:17 <stepcut> burp: happstack-state 0.6 might not. happstack-state 0.7 will.
22:20:26 <burp> yeah, looking forward :D
22:20:31 <stepcut> me too
22:20:48 <burp> are especially you working on -state?
22:20:51 <stepcut> 0.6 is nearly done, but I just had a bunch of other things come up. Should get it out in september though.
22:21:43 <stepcut> yep. 0.6 is all about getting -server into good shape. 0.7 will focus on -state and -ixset. for 0.8, we might look at working with tibbel on getting hyena going
22:22:19 <stepcut> so that we can have a fast, iteratee based backend for happstack-server.
22:23:14 <stepcut> the current happstack-server is pretty fast, but with hyena could give us a 50-100% boost in speed, less code to  maintain, and some better space usage guarantees
22:23:55 <stepcut> unless tibbel has some extra tricks up his sleeve, in which case we might possibly go faster
22:24:58 <stepcut> but a number of different sources lead me to believe that on my laptop the current -server backend will do around 7000 reqs/second. And the maximum possible (for any haskell based http server) is somewhere less than 19,000 reqs/second
22:25:11 <stepcut> (on my laptop)
22:25:22 <burp> guess the raw speed will be fine in any way
22:25:40 <burp> as in real world applications the slowdown will be much bigger by database access etc.
22:25:53 <stepcut> right. That is why happstack-state is really the more interesting piece to work on
22:25:55 <burp> so if the server could handle 10k or 20k requests / second
22:25:59 <t3eblinder> stepcut: newtype ConnectionT m a = ConnectionT { runConnectionT :: (IConnection conn) => ReaderT conn m a } only works without deriving. This seems to be the same as in your Web.hs with ConfigT?
22:26:03 <burp> doesn't matter that much for it
22:26:23 <stepcut> t3eblinder: I am about to start my solution, give me 10 mins
22:26:35 <stepcut> t3eblinder: less if I stop yapping
22:27:22 <t3eblinder> stepcut: sorry i'm waiting ;)
22:27:30 <stepcut> t3eblinder: :)
22:47:31 <stepcut> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=29427#a29427
22:48:18 <stepcut> so, in getUser, we use both 'ask' from MonadReader and 'ok' which user FilterMonad, with out having to use lift at all
22:48:33 <stepcut> you could also use, dir, path, etc.
22:50:18 <stepcut> in that code we are storing the db connection in the 'config' slot, but you could use it to store anything
22:52:16 <t3eblinder> I think that it is what i was looking for :-)
22:53:48 <stepcut> yeah, I need to clean that up and make it a blog post
22:53:53 <stepcut> it's a very useful idiom
22:55:36 <t3eblinder> yes a blog post is a good idea ;)
22:57:35 <stepcut> it's a great idea! you could even do it :p
22:59:19 <t3eblinder> stepcut: ;)
22:59:40 <stepcut> people need to blog more about happstack
23:00:14 <stepcut> and include the phrase 'haskell web framework' and a link to happstack.com in the post :)
23:00:34 <t3eblinder> when i've finished my happstack blog app i will post about happstack for sure :-)
23:00:54 <stepcut> is that what you are making?
23:01:37 <t3eblinder> yes, the basic idea is a blog app. more about learning haskell better
23:05:33 <stepcut> nice