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

A 'field'-like traversal? #121

Open
neongreen opened this issue May 15, 2020 · 2 comments
Open

A 'field'-like traversal? #121

neongreen opened this issue May 15, 2020 · 2 comments

Comments

@neongreen
Copy link

neongreen commented May 15, 2020

When only one of several branches has the given field, I can't use field:

    • Not all constructors of the type TypeExpr
       contain a field named 'constraints'.
      The offending constructors are:
      • TypeLitString
      • TypeNormal
      • TypeRow
      • TypeBareRecord

It would be great to have a traversal that lets me ignore the warning and just .~ or ^?! the field.

@prednaz
Copy link

prednaz commented Aug 17, 2020

I think, makeFieldLabelsWith noPrefixFieldLabels with the optics package produces the instances @neongreen wants.

@arybczak
Copy link
Contributor

FWIW optics has now also got gafield for this.

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

No branches or pull requests

3 participants