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

Helpful instances for deriving Codec #103

Closed
bruderj15 opened this issue Sep 9, 2024 · 0 comments · Fixed by #105
Closed

Helpful instances for deriving Codec #103

bruderj15 opened this issue Sep 9, 2024 · 0 comments · Fixed by #105
Labels
improvement Improve existing feature

Comments

@bruderj15
Copy link
Owner

Very often we have types like:

data FooBar a = FooBar
  { _fbId  :: Integer
  , _foo   :: a
  , _bar   :: a
  } deriving stock (Generic)
    deriving anyclass (Codec)

This requires:

instance Codec Integer where
  type Decoded Integer = Integer
  decode _ = Just
  encode = id

Provide such helper instances for standard types.

@bruderj15 bruderj15 added enhancement New feature or request improvement Improve existing feature and removed enhancement New feature or request labels Sep 9, 2024
@bruderj15 bruderj15 linked a pull request Sep 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant