spl / dlist

Difference lists in Haskell
https://hackage.haskell.org/package/dlist
BSD 3-Clause "New" or "Revised" License
65 stars 15 forks source link

compat: Expose DNonEmpty across more versions of `base` #118

Open 414owen opened 9 months ago

414owen commented 9 months ago

Functions that convert to/from NonEmpty are gone, but everything that you strictly speaking need to use DNonEmpty is there.

spl commented 7 months ago

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?

414owen commented 7 months ago

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.