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

Introduce HasCallStack on new GHC versions #368

Merged
merged 4 commits into from
Mar 19, 2024
Merged

Conversation

MaximilianAlgehed
Copy link
Collaborator

Closes #235

@nick8325
Copy link
Owner

I suppose we could avoid duplicating the type signatures by doing something like:

#ifndef NO_CALLSTACK
import GHC.Stack
#define WITHCALLSTACK(ty) HasCallStack => ty
#else
#define WITHCALLSTACK(ty) ty
#endif

and then the type signatures would just be e.g. resize :: WITHCALLSTACK(Int -> Gen a -> Gen a).

@MaximilianAlgehed
Copy link
Collaborator Author

That's a good idea. I was thinking about doing something like type WithCallStack a = a or similar but I wasn't confident that no compiler would complain about that (though they shouldn't?!)

@MaximilianAlgehed
Copy link
Collaborator Author

But the macro idea is nicer because it won't show up in the Haddocks.

@MaximilianAlgehed MaximilianAlgehed merged commit 65d29b0 into master Mar 19, 2024
56 checks passed
@MaximilianAlgehed MaximilianAlgehed deleted the PR-hascallstack branch March 19, 2024 12:58
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.

3 participants