Skip to content

ADTs example #10

Description

@BebeSparkelSparkel

I have figured out how to parse an ADT but am not sure how to serialize it well. Instead of the constructor being the initial function, a function that picks the constructor would be the starting function. However, I am not sure how to continue from there.

Using JSON:

data StringEncoded
  = Date Year Month Day
  | Money Currency Int

stringEncodedObjCodec :: JSONCodec StringEncoded
stringEncodedObjCodec = ???

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions