Add deferManyElse and deferEither to Heist.Compiled#120
Add deferManyElse and deferEither to Heist.Compiled#120kaol wants to merge 1 commit intosnapframework:masterfrom
Conversation
e364dea to
5a32eed
Compare
|
This looks good, but it's not building on older GHCs (see https://travis-ci.org/github/snapframework/heist/builds/637120129). Any chance we could preserve that compatibility? |
|
Easy, it just needs to use |
5a32eed to
f58893b
Compare
|
Hmmm, it doesn't look like CI was triggered. Perhaps that's because it was a force push? |
|
I created another local branch and that doesn't seem to have fixed it. https://travis-ci.org/github/snapframework/heist/builds/701697177 |
f58893b to
d5edfa3
Compare
|
I amended and force pushed another version of this. Copying |
I would like to propose these two new functions for Heist.Compiled.
deferManyElseis useful for showing "no results" or some such message when passed an empty Foldable. I was consideringmaybeDeferas the name since it's analogous tomaybebutmaybeis useful for justMaybeand not forFoldablein generic.deferEitheris much likeeitherbut for splices. At least my code's full of splices that do DB operations and I need to do something with all the runtime Lefts.I'm not proposing adding any
deferManyElseMapordeferEitherMap, sincedeferEitherMap f a b ncan be written as justdeferEither a b $ f =<< n. Same goes fordeferManyElseMap.If it was up to me, I would deprecate both
deferMapandmayDeferMap, since they can be substituted withdeferanddeferMany, respectively.