haskell-compat / base-compat

A compatibility layer for base
http://hackage.haskell.org/package/base-compat
19 stars 12 forks source link

Generically/1 #84

Closed phadej closed 2 years ago

phadej commented 2 years ago

base-4.17 will include these new newtypes. It would be great to have them somewhere in a compat package.

If latter option is chosen, the base-compat-batteries may or may not re-export it, but generic-deriving could.

Does @RyanGlScott have an opinion on this? I prefer latter, but I'll be happy to sketch either option.

RyanGlScott commented 2 years ago

base-compat has a policy of not backporting data type definitions (see here), so I would prefer having a dedicated package for this purpose. As you've noted, generic-deriving might be a somewhat awkward fit for this purpose, so a separate generically package might be best. Would you want to put generically under the haskell-compat organization?

phadej commented 2 years ago

Would you want to put generically under the haskell-compat organization?

That would make a lot of sense.

I created a stub package at https://github.com/phadej/generically, but I'll be happy to transfer it under this org.

RyanGlScott commented 2 years ago

I created a stub package at https://github.com/phadej/generically, but I'll be happy to transfer it under this org.

Cool. Do I need to do anything before it can be transferred over to haskell-compat?

phadej commented 2 years ago

If I try to transfer it I get You don’t have the permission to create public repositories on haskell-compat error from GitHub. So either I'd need rights to do that, or you could just create a new repo and push the contents there.

RyanGlScott commented 2 years ago

Alright. In that case, I've created https://github.com/haskell-compat/generically and given you the appropriate permissions.

phadej commented 2 years ago

Thanks. I'd appreciate a review of it.

I put the lowest supported GHC version at GHC-8.0, as it was easy (e.g. no need to think about Eq1 stuff pre base-4.9), and it's still low enough that in most libraries nowadays one won't need to worry about CPP when defining instances for Generically.

I already uploaded a candidate, I'll add you as a maintainer on Hackage too. (EDIT: done https://hackage.haskell.org/package/generically/maintainers/)

RyanGlScott commented 2 years ago

I'd appreciate a review of it.

I've left some inline comments on haskell-compat/generically@e7d4bde0673a40344cebcaad6e87d52d9633b70b. Generally, the code in the generically library looks reasonable. I do think things should be documented a bit more before releasing to Hackage, however.

I put the lowest supported GHC version at GHC-8.0, as it was easy (e.g. no need to think about Eq1 stuff pre base-4.9), and it's still low enough that in most libraries nowadays one won't need to worry about CPP when defining instances for Generically.

OK. That is probably a reasonable choice, although I'll need to think about what this means for base-compat-batteries, since it has a wider GHC support window than generically at the moment.

phadej commented 2 years ago

although I'll need to think about what this means for base-compat-batteries,

E.g. https://hackage.haskell.org/package/base-compat-batteries-0.12.1/docs/src/Data.Type.Equality.Compat.html isn't uniform API either. It's probably possible to push generically support all the way down to GHC-7.0, but I don't know if it's worth the trouble.

RyanGlScott commented 2 years ago

True, I forgot about type-equality. In that case, if we decide to re-export generically from base-compat-batteries, we can simply do so only on GHC 8.0 or later.

phadej commented 2 years ago

https://hackage.haskell.org/package/generically-0.1 published