--- Log opened Thu Oct 08 00:00:54 2009
08:59 < Raevel> when i use the following controller:
08:59 < lambdabot> Raevel: You have 1 new message. '/msg lambdabot @messages' to read it.
08:59 < Raevel> controller = exactdir "/" . liftIO $ return . toResponse =<< getDirectoryContents "."
08:59 < Raevel> i get the following error
09:00 < Raevel> HTTP request failed with: src/Happstack/Data/Xml/HaXml.hs:22:19-42: Irrefutable pattern failed for pattern Text.XML.HaXml.Types.CElem el'
09:00 < Raevel> anyone know what's happening?
09:01 < Raevel> exactdir "/" . return . toResponse $ "foo" works fine
09:09 < mightybyte> @hoogle exactdir
09:09 < lambdabot> No results found
09:09 < mightybyte> What exactdir are you using?
09:58 < Raevel> oh, i'm back
09:58 < mightybyte> I'm still here
09:58 < Raevel> the one from happstack-helpers, which is...
09:58 < mightybyte> Ahhh
09:58 < mightybyte> I don't use happtsack-helpers.
09:59 < Raevel> http://pastie.caboo.se/paste/646896
10:02 < mightybyte> You may need to add some ()
10:04 < Raevel> hmm
10:07 < Raevel> it's the same as exactdir "/" $ liftIO (do f' <- getDirectoryContents "."; return . toResponse $ f'), is that incorrect?
10:08 < mightybyte> Well, in the first version you mentioned here, you had exactdir "/" . lift...
10:10 < Raevel> right, either way i get the same haxml error
10:12 < Raevel> anway, it seems like a very strange error message to me, i don't understand what haxml has to do with this :-)
10:12 < mightybyte> Try it without point-free style.
10:15 < Raevel> exactdir "/" (liftIO (do f <- getDirectoryContents "."; return (toResponse f))) -- same error
10:16 < mightybyte> You're using System.Directory.getDirectoryContents?
10:16 < Raevel> yep
10:29 < mightybyte> Have you tried exactdir ""?
10:29 < Raevel> i hope so :-)
10:30 < Raevel> yeah, the / is needed for it to match
10:31 < mightybyte> Ok, wasn't sure.
10:31 < Raevel> like i said: 15:01 <Raevel> exactdir "/" . return . toResponse $ "foo" works fine
10:31 < mightybyte> So it would appear that it's something in the (toResponse f)
10:31 < mightybyte> Try toResponse $ show f
10:32 < Raevel> alright
10:32 < Raevel> i really appreciate the help!
10:32 < mightybyte> No problem.  Although I haven't been much help yet.
10:32 < Raevel> TADAAAA
10:32 < Raevel> you did it my friend
10:33 < mightybyte> Great
10:33 < Raevel> so, there's some bug in toResponse?
10:33 < mightybyte> No idea.
10:34 < mightybyte> Looks like there might not be a ToMessage instance for lists
10:36 < mightybyte> Ahhh, yes:
10:36 < mightybyte> instance ToMessage [Element] where
10:36 < mightybyte>     toContentType _ = B.pack "application/xml"
10:36 < mightybyte>     toMessage [el] = L.pack $ H.simpleDoc H.NoStyle $ toHaXmlEl el -- !! OPTIMIZE
10:36 < mightybyte>     toMessage x    = error ("Happstack.Server.SimpleHTTP 'instance ToMessage [Element]' Can't handle " ++ show x)
10:38 < Raevel> it tries to make an xml document out of it? :-o
10:38 < Raevel> that would of course explain the haxml error somewhat :-)
10:38 < mightybyte> Yeah, apparently so.
10:38 < mightybyte> I'm not quite sure why it doesn't fail to typecheck.
10:44 < Raevel> or why lists should only contain one element which should be turned into xml?
10:45 < mightybyte> True
13:09 < dons> hey happs guys
13:09 < dons> did anyone try benchmarks with the new Data.Binary release yet?
14:31 < mightybyte> What kind of benchmarks?  space or speed?
14:34 < dcoutts> mightybyte: speed
14:35 < dcoutts> we shouldn't be changing formats, at least not without big warnings
14:35 < mightybyte> True.  I've never had speed problems, so I don't pay much attention to that aspect of things.
14:50 < mightybyte> Although...I coded up a CompactIxSet that uses Data.Binary under the hood.  I haven't had time to actually test it yet, but your speed improvements might be noticeable there.
--- Log closed Fri Oct 09 00:00:55 2009