
On Fri, Mar 15, 2013 at 3:30 PM, James Cook
On Mar 15, 2013, at 2:45 PM, Jason Dagit
wrote: I haven't been following the thread closely. Is there also a github? If so, where? Some of us figured out a bug fix for the quotes plugin and I'll send a pull request if I get a chance.
Yep, there is[1]. I'm not sure what the specific bug is that you are referring to, but it's possible it doesn't exist anymore - a large part of the quotes plugin has been rewritten (actually outsourced to a fortune-mod clone written in Haskell called "misfortune"). If it still does, then of course I'd be happy to accept a fix :)
Awesome. I believe the bug is still there. The type for the quote db is: type Key = P.ByteString type Quotes = M.Map Key [P.ByteString] Which leaves the possibility that a key exists but there are no quotes. This is problematic for the current version of random. I glanced at your new version and it wasn't clear to me if it's still a problem (I suspect it is). One bandaid for this is to change the lines below: https://github.com/mokus0/lambdabot/blob/master/src/Lambdabot/Plugin/Quote.h... https://github.com/mokus0/lambdabot/blob/master/src/Lambdabot/Plugin/Quote.h... In both cases "Just qs" could be changed to "Just qs@(_:_)" and then empty lists would fall through to the default case. The other fix is to prune out degenerate entries (where key maps to the empty list). I believe that would be fixed in the serialization function: moduleSerialize = Just mapListPackedSerial Changing that to something like: moduleSerialize = Just mapListPackedSerialSansEmpties where mapListPackedSerialSansEmpties = mapListPackedSerial { serialize = (serialize mapListPackedSerial) . Map.filter (not.null) } Perhaps that should be added to the Serial module as an alternative to mapListPackedSerial. I haven't tested any of the above code (or even tried to compile it). Jason