--- Log opened Fri Jan 08 00:00:06 2010
--- Day changed Fri Jan 08 2010
00:00 < aavogt> you could write your own Response instance using that webHSP
00:02 < pham> problem is webHSP returns "m Response"
00:03 < pham> I ended having to write: handler = msum [ ... , page_404 >>= notFound ] -- to account for the monad type
01:37 < pham> can you make dynamic attributes with HSP?
01:38 < pham> like how would you make an img function (this doesn't work: img src = <img src="<% src %>"> -- )
01:38 < pham> (and no, that's not what I'm doing)
01:46 < pham> oh duh, just remove the <% %>
02:27 < pham> ok, here's a real question: I want to combine two "HSP XML" fragments in to one
04:23 < pham> another question (still haven't figured out "HSP XML" concatonation): can you make your own tags with HSP?
04:29 < pham> oh, apparently a list works. Must be something weird with the parsing when I tried that
04:44 < pham> my deal is there's a certain tag where whenever I use it I'm going to want one or more attributes that I don't want to repeat
04:44 < pham> I could write a little function, but then I have to use <% %> every time
06:05 < pham> where's some example code that processes POST data?
06:36 < pham> this is kicking my ass
07:13 < pham> BLARG, the latest version of happstack ditched webHSP
07:13 < pham> I wonder what replaced it
08:19 < SubStack> stringtemplate?
08:32 < pham> I was wrong... Happstack.Server.HSP.HTML is part of the package happstack, not happstack-server like I assumed
08:32 < pham> and happstack-server doesn't depend on happstack, so it simply wasn't installed
08:42 < pham> ahg, I just spent about 4 hours determining that I needed getDataFn instead of getData. This is why I shouldn't try to write code when sleep deprived
10:28 < sm> morning all
10:28 < sm> "ServerMonad is just a ReaderMonad that contains the Request" - would it be easier to understand if called WithRequest, then ?
10:29 < McManiaC> Server error: Prelude.chr: bad argument
10:30 < McManiaC> what is that error message about?
10:30 < McManiaC> someone tried to paste binary stuff on my pastebin, and I get this error message
10:30 < McManiaC> (a jpg file)
10:31 < mightybyte> McManiaC: Check out http://haskell.org/onlinereport/char.html
10:32 < McManiaC> Int too big maybe?
10:32 < McManiaC> is there a way to get a backtrace of that error message?
10:33 < mightybyte> Haskell doesn't lend itself well to traditional stack traces.
10:34 < sm> I seem to think there is a way though.. run in ghci or use some profiling flag ?
10:43 < stepcut> pham: you can create your own tags by simply putting whatever you want between the angle brackets. But you will need to write your own function to actually walk over the resulting xml and transform it the way you want
10:52 < aavogt> there was some paper on adding backtraces to ghc, which is sort of like the ghci debugger, but you don't have to step through evaluation or something
10:53 < aavogt> http://portal.acm.org/ft_gateway.cfm?id=1596654&type=pdf
10:53 < stepcut> McManiaC: do you set the encoding to utf-8 in your <head> and in your <form> ?
11:07 < stepcut> mightybyte: I emailed you a patch for happstack-extra
11:08 < stepcut> mightybyte: we are building it against GHC 6.13 now, hopefully we did not break older compilers.. if we did let me know
11:09 < mightybyte> Ok.  The darcs pull ran all night but still wasn't finished this morning.
11:09 < mightybyte> It's stuck on 127/142 right now.
11:09 < mightybyte> Hmmm, I might not even be able to apply that patch if I can't finish this update.
11:10 < mightybyte> Should I try to get a brand new copy of the repo?
11:11 < mightybyte> Wow, "darcs get" finished very quickly.
11:13 < stepcut> yeah, darcs is funky somehow
11:13 < stepcut> dunno if it is just our server or something with darcs :-/
11:15 < aavogt> darcs might have forgotten to retry some connection?
11:15 < mightybyte> cabal: cannot configure happstack-extra-0.77. It requires html-entities -any
11:15 < mightybyte> There is no available version of html-entities that satisfies -any
11:16 < aavogt> but such a bug (if it exists) is difficult to isolate and reproduce... but maybe it's a concern of the network library instead...?
11:16 < stepcut> mightybyte: http://src.seereason.com/html-entities/
11:17 < mightybyte> stepcut: Ok, got it.
11:18 < mightybyte> Hmmmm, I'm thinking that we happstackers need to start putting our packages in hackage.
11:18 < mightybyte> (and I'm just as much to blame as anyone else)
11:18 < stepcut> what do you use from happstack-extra anyway? I want to merge a bunch of happstack-extra into happstack-{kitchensink}
11:18 < mightybyte> Not sure
11:18 < mightybyte> Let me see...
11:19 < stepcut> the fact that until recently we depended on a forked formlets was a stumbling block for us uploading to hackage, so I am glad we are finally getting ourselves unforked!
11:19 < McManiaC> ok hmmm
11:20 < McManiaC> how can I debug this? Control.Exception can handle only IO functions
11:20 < mightybyte> Oh, I guess happstack-facebook requires it.
11:20 < stepcut> mightybyte: ah
11:21 < stepcut> in the latest happstack-facebook that dependency is optional, and disabled by default
11:28 < McManiaC> how can I catch the error of "getDataFn"?
11:30 < McManiaC>     liftIO $ E.handle (\(e :: E.IOException)-> undefined) $ getDataBodyFn $ look "content"
11:30 < McManiaC>     No instance for (ServerMonad IO)
11:30 < McManiaC>       arising from a use of `getDataBodyFn'
11:36 < stepcut> dunno
11:37 < stepcut> somehow :)
11:38 < stepcut> maybe..
11:45 < McManiaC> :S
11:45 < McManiaC> I need to try ghc 6.12 on this...
11:48 < stepcut> ?
11:49 < stepcut> McManiaC: when, exactly, do you get the 'Prelude.chr: bad argument' error? When processing the POST data ?
11:52 < McManiaC> yeh
11:53 < McManiaC> getDataBodyFn $ look "content" <- there
11:53 < stepcut> look = fmap LU.toString . lookBS
11:53 < stepcut> look calls toString on the incoming bytestring
11:53 < McManiaC> LU ?
11:54 < McManiaC> okay
11:54 < stepcut> import qualified Data.ByteString.Lazy.UTF8       as LU
11:55 < stepcut> 'look' assumes that the incoming bytestring contains a utf-8 encoded string.. if it does not, then something bad will happened
11:55 < stepcut> but one question is, why are you receiving non utf-8 encoded data from the browser
11:56 < McManiaC> cat <somefile> | curl -F "content=<-" ...
11:56 < McManiaC> dont ask me
11:56 < McManiaC> ^^
11:57 < stepcut> normally, in the .html you should be setting,       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11:57 < stepcut> and            <form action="/entries" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
11:57 < stepcut> so that the browser will send you utf-8 encoded data
11:57 < McManiaC> that guy didnt use the html form
11:58 < stepcut> or maybe they browsers could not figure out how to utf-8 encode the data so they didn't
11:58 < stepcut> did someone report this as a bug ?
11:58 < stepcut> a bug in your app ?
11:59 < McManiaC> yup
11:59 < stepcut> what do you think should happen?
12:00 < stepcut> rather, what would you like to happen when submit submits non utf-8 data to a field that is supposed to be a utf-8 encoded string?
12:01 < McManiaC> hmmm dunno
12:01 < McManiaC> catch that error
12:01 < McManiaC> ;)
12:01 < stepcut> and then what?
12:01 < McManiaC> "Invalid content" or something
12:02 < McManiaC> as I do with empty/too big content etc
12:03 < stepcut> I don't really know how to catch that error. I think it can only be caught in the IO monad, which means you can't really catch it where you want to..
12:04 < stepcut> I am actually not sure why you are getting the Prelude.chr error though
12:05 < McManiaC> me neither :S
12:07 < stepcut> if the utf-8 string contains an error, the decode function should just substitute in '\xfffd' where the bad character is
12:07 < stepcut> I don't think it calls Prelude.chr at all
12:07 < McManiaC> yeh
12:08 < McManiaC> since you can actually "putStrLn" any binary data
12:08 < stepcut> so maybe it is failing somewhere else
12:08 < McManiaC> its definitly that call...
12:08 < stepcut> well, when you putStrLn binary data in < 6.12, it truncates the values to 8-bits I think
12:08 < McManiaC> jup
12:09 < McManiaC> I'm building ghc 6.12 atm to test this
--- Log closed Sat Jan 09 00:00:21 2010