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

Allow null in metadata #914

Open
kirelagin opened this issue Dec 18, 2021 · 1 comment
Open

Allow null in metadata #914

kirelagin opened this issue Dec 18, 2021 · 1 comment
Labels

Comments

@kirelagin
Copy link

kirelagin commented Dec 18, 2021

If I am not mistaken, YAML has a special null literal. What if the metadata parser returned an empty field on null?

That would probably make no difference currently, but together with #913 that would allow one, for example, to set title: null to remove the title from defaultContext without having to write any context manipulation code in Haskell.

I’m not sure how useful it is, but it seems to be very easy to implement, so, I was thinking, why not? (Also, somewhat related, #348 (comment).)

@Minoru
Copy link
Collaborator

Minoru commented Jan 6, 2022

This requires defaultContext to become Context (Maybe String): empty would signal lack of value while Nothing signals that the value is "null". I can't tell offhand how big of an impact this will have on other modules and interfaces; e.g. Hakyll.Core.Metadata.lookupString uses Nothing to indicate "value not found", so I wonder how many other public interfaces are don't distinguish between the absence of value and "null".

So I kind of ambivalent about the idea, and fearful that implementing it will bring more problems than it resolves. If you feel strongly about it, please make a draft PR to demonstrate that it's not as bad as I imagine :)

@Minoru Minoru added the feature label Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants