Skip to content

Ideas regarding Alternative instance for 'profunctor-monad' #1

@chshersh

Description

@chshersh

Hello! I'm using this approach to write bidirectional parser and pretty-printer for TOML:

Now I want to be able to encode and decode sum types. And Alternative type class looks like a good pattern for such things. But, unfortunately, I can't figure out clean way to do it.

Maybe you could give some ideas and tips regarding how to deal with sum types in this approach? I can introduce dirty hacks and workarounds without problems, but it would be great to have some idiomatic and clean solution!

In examples for codec library I see only record types, no sum types, so I'm a little bit confused by this problem 🤔

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