On Fri, Mar 15, 2013 at 4:31 PM, Jason Dagit <dag...@gmail.com> wrote:
> > > On Fri, Mar 15, 2013 at 3:30 PM, James Cook <mo...@deepbondi.net> wrote: > >> On Mar 15, 2013, at 2:45 PM, Jason Dagit <dag...@gmail.com> 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 :) >> >> [1] https://github.com/mokus0/lambdabot >> >> > 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.hs#L161 > > https://github.com/mokus0/lambdabot/blob/master/src/Lambdabot/Plugin/Quote.hs#L166 > > 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). > I was going to start making these changes and I noticed that it doesn't currently build with ghc 7.4.1 w/Haskell Platform: https://travis-ci.org/dagit/lambdabot/builds/5541375 Do you know if the constraints on: regex-posix-0.95.1 regex-compat-0.95.1 Need to be what they are? Could we relax them without breaking anything? Jason
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe