compat: Expose DNonEmpty across more versions of `base`
- Add CPP guards around some instances
- Remove some conditional cabal
- Use NonEmpty-based fold functions directly
- Add tests for fold instance
- Add handwritten Read instance
- Disable DNonEmpty test suite on base <4.9.0
Functions that convert to/from NonEmpty are gone, but everything that you strictly speaking need to use DNonEmpty is there.
Thanks for taking the time to do this, but I'm a bit unsure about the motivation or need for this change. Could you be more explicit about what is gained by doing this? What were you unable to do before this change?
Sure, I have a library called multi-except, which lets you applicatively build up multiple errors. It exports them as a NonEmpty, and uses a non-empty dlist internally.
I'm a big believer in libraries casting as wide a compatibility net as possible, as it really helps avoid dependency hell. This is especially true of such universal (and useful) libraries as dlist.
Multi-except currently supports ghc >=7.0.4, with base being its only dependency. I did this by using my own inline implementation of non-empty dlists. This seems acceptable, because it's such a small amount of code, but at the same time, I don't think the functor instance is optimal.
I would prefer to use the implementation from the dlist package, so that I get the advantages of all the thought put into this library, but I don't want to sacrifice compatibility.