Skip to content

Add encode/decode instances for Identity a #54

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

Merged
merged 1 commit into from
May 27, 2019
Merged

Add encode/decode instances for Identity a #54

merged 1 commit into from
May 27, 2019

Conversation

ajnsit
Copy link
Contributor

@ajnsit ajnsit commented Mar 14, 2019

What does this pull request do?

Adds trivial encode/decode instances for Identity a. I ran into this when trying to encode a data type that looks like this -

data Entity f = Entity
  { guid :: f Guid
  , <some other fields here>
  }

When the entity has a Guid it can be persisted as Entity Identity. This is a very common pattern.

However in the absence of an encode instance for Identity a, I have to manually encode Entity while unwrapping the guid field, which is a bit ugly.

@thomashoneyman thomashoneyman self-assigned this Apr 23, 2019
@thomashoneyman thomashoneyman merged commit 9a1c0e0 into purescript-contrib:master May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants