Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give TextShow{1,2} quantified superclasses #58

Merged
merged 5 commits into from
Oct 4, 2022
Merged

Give TextShow{1,2} quantified superclasses #58

merged 5 commits into from
Oct 4, 2022

Conversation

RyanGlScott
Copy link
Owner

This mirrors a corresponding change to the Show1 and Show2 classes in base—see haskell/core-libraries-committee#10. A consequence of this change is that all TextShow1 instances now require corresponding TextShow instances. This affects the TextShow.Generic module, as we now have to define a TextShow instance for FromGeneric1. Similarly, all TextShow2 instances now require corresponding TextShow and TextShow1 instances.

Fixes #56.

RyanGlScott and others added 5 commits October 2, 2022 18:43
Currently, all of the `Generic`-related functionality for both `TextShow` and
`TextShow1` is contained within a single set of `GTextShow*` classes. This
proves troublesome when attempting to add a quantified superclass to
`TextShow1`, however, because if we were to define a `TextShow` instance for
`FromGeneric1 f a` (as required by the quantified superclass), then we would
have to add `TextShow a` to the instance context, which is too constrained.

This takes a different approach by splitting `GTextShow*` into two sets of
classes: one `GTextShow*` set (specifically for generic derivation of
`TextShow` functionality) and another `GTextShow1*` set (specifically for
generic derivation of `TextShow1` functionality). This requires some
backwards-incompatible changes to the API in `TextShow.Generic`, but this
change will not affect most users of the code.

This is in preparation for a subsequent commit targeting #56.
This mirrors a corresponding change to the `Show1` and `Show2` classes in
`base`—see haskell/core-libraries-committee#10.
A consequence of this change is that all `TextShow1` instances now require
corresponding `TextShow` instances. This affects the `TextShow.Generic` module,
as we now have to define a `TextShow` instance for `FromGeneric1`. Similarly,
all `TextShow2` instances now require corresponding `TextShow` and `TextShow1`
instances.

Fixes #56.
This library has a habit of tickling old GHC simplifier bugs, and this time,
we've hit one in 8.10. Oh well. What's a little more CPP among friends?
The `INLINE` annotations don't cause the compile times to blow up on older
versions of GHC like they do on 8.10, but they do increase noticeably enough
(usually a couple minutes or more on GitHub Actions CI jobs) to the point where
I'm not comfortable with it. Luckily, this doesn't happen on 9.2 or later, so
let's just restrict the use of `INLINE` annotations to those versions.
@RyanGlScott RyanGlScott merged commit 97cab51 into master Oct 4, 2022
@RyanGlScott RyanGlScott deleted the T33-alt2 branch October 4, 2022 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding quantified TextShow superclasses to TextShow{1,2}
1 participant