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

Remove special-casing when singling error and friends #597

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

RyanGlScott
Copy link
Collaborator

Previously, singExp had a number of ad hoc special cases for handling functions that look like exceptions (e.g., sError and sUndefined). This was because their return types are a rather than, say, Sing (Undefined @a), which impaired GHC's ability to typecheck singletons-th–generated code. As discussed in #588, however, there doesn't appear to be any good reason for these functions to have return types that are so polymorphic, which called into question why we are maintained these ad hoc special cases in the first place.

This patch removes the special casing and gives sError, sErrorWithoutStackTrace, and sUndefined less polymorphic return types. The upshot is that I was able to delete a fair bit of ugly code from D.S.TH.Single, which is a nice payoff.

Fixes #588.

Previously, `singExp` had a number of _ad hoc_ special cases for handling
functions that look like exceptions (e.g., `sError` and `sUndefined`). This was
because their return types are `a` rather than, say, `Sing (Undefined @A)`,
which impaired GHC's ability to typecheck `singletons-th`–generated code. As
discussed in #588, however, there doesn't appear to be any good reason for
these functions to have return types that are so polymorphic, which called into
question why we are maintained these _ad hoc_ special cases in the first place.

This patch removes the special casing and gives `sError`,
`sErrorWithoutStackTrace`, and `sUndefined` less polymorphic return types. The
upshot is that I was able to delete a fair bit of ugly code from
`D.S.TH.Single`, which is a nice payoff.

Fixes #588.
@RyanGlScott RyanGlScott merged commit 44edc38 into master Jun 6, 2024
24 checks passed
@RyanGlScott RyanGlScott deleted the T588-remove-error-special-casing branch June 6, 2024 11:18
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 removing special-casing for error during singling
1 participant