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

Add Empty inline #298

Merged
merged 2 commits into from
Feb 14, 2023
Merged

Add Empty inline #298

merged 2 commits into from
Feb 14, 2023

Conversation

cuihtlauac
Copy link
Contributor

@cuihtlauac cuihtlauac commented Dec 6, 2022

Fix #297

@cuihtlauac cuihtlauac mentioned this pull request Dec 6, 2022
| Empty
| Concat of 'attr * 'attr inline list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly unsure what we gain by introducing the Empty data constructor here. If we want a unit value, that would already be available as Concat ([], []), and we could add, e.g., a named value as a shorthand for this: let empty attr = Concat (attr, [])

Meanwhile, adding a new data constructor will require additional cases during analysis that don't actually improve the logic afaict.

Do you perhaps have any examples in mind where an explicit Empty data constructor is helps clarify things that couldn't be addressed through my proposed empty value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should have explained where this comes from.

The initial use case came from the need being able to have a link with an empty label (of type inline), filled later with CSS.

I fully agree using a shorthand, as you propose, is a better solution, as it avoids having two ways to represent the same thing (Empty and Concat ([], []). I had overlooked that.

I'll update the PR with your proposal.

Copy link
Collaborator

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

@shonfeder shonfeder merged commit 0c224ce into ocaml-community:master Feb 14, 2023
avsm added a commit to avsm/opam-repository that referenced this pull request Jul 24, 2023
CHANGES:

- Add an `empty` inline value (ocaml-community/omd#298 @cuihtlauac)

- Remove stdcompat dependency (ocaml-community/omd#304 ocaml-community/omd#305 @hannesm, review by @samoht)

- Minimum supported OCaml version is now 4.13 (ocaml-community/omd#304 @hannesm)
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
CHANGES:

- Add an `empty` inline value (ocaml-community/omd#298 @cuihtlauac)

- Remove stdcompat dependency (ocaml-community/omd#304 ocaml-community/omd#305 @hannesm, review by @samoht)

- Minimum supported OCaml version is now 4.13 (ocaml-community/omd#304 @hannesm)
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

Successfully merging this pull request may close these issues.

Empty Inline
2 participants