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

Add support for deriving instances via Generically #108

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Conversation

tfausak
Copy link
Owner

@tfausak tfausak commented Nov 7, 2024

Fixes #107.

import qualified GHC.Generics as Generics
import qualified Witch.From as From

class GFrom s t where
Copy link
Owner Author

@tfausak tfausak Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all implementation details. End users wouldn't need to know or care about GFrom.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, I should either hang some documentation on this or on the From s (Generically t) instance.

@tfausak
Copy link
Owner Author

tfausak commented Nov 7, 2024

In terms of motivation, I think this would mostly be useful for application code. Witch doesn't provide instances for tuples, for example. And I don't want to provide them even though they could be derived Generically.

Perhaps something could also be done for TryFrom instances, but that feels a lot trickier.

@tfausak tfausak merged commit bb47388 into main Nov 7, 2024
11 checks passed
@tfausak tfausak deleted the gh-107-generically branch November 7, 2024 18:46
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 instances for converting using Generically
1 participant