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

Definition.hs: add and export new lookupMeta* functions #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mb21
Copy link
Contributor

@mb21 mb21 commented Sep 16, 2018

lookupMetaInlines, lookupMetaBlocks and lookupMetaBool

This is an API change.

Needed for jgm/pandoc#4907.

`lookupMetaInlines`, `lookupMetaBlocks` and `lookupMetaBool`

This is an API change.
@jgm
Copy link
Owner

jgm commented Sep 16, 2018

Instead of having these different functions, we could introduce a version of lookupMeta with a more general type:

lookupMeta' :: FromMetaValue a => Meta -> Maybe a

and have a FromMetaValue class. That might be more elegant, no?

@mb21
Copy link
Contributor Author

mb21 commented Sep 16, 2018

Hm.. since none of the three added functions return a Maybe, it would have to be:

lookupMeta' :: FromMetaValue a => String -> Meta -> a

But then we'd need to enable FlexibleInstances. Or we go with:

lookupMeta' :: FromMetaValue a => String -> Meta -> [a]

But that leaves the Bool case uncovered.

@mb21
Copy link
Contributor Author

mb21 commented Sep 27, 2018

Or I can simply add the three new functions to Text.Pandoc.Writers.Shared instead. Although they are indeed very similar to those existing in pandoc-types: lookupMeta, docTitle, docAuthors and docDate.

@jgm
Copy link
Owner

jgm commented Sep 28, 2018 via email

@mb21
Copy link
Contributor Author

mb21 commented Sep 28, 2018

Okay, I'll leave this pull open in case you want to move the functions over from Text.Pandoc.Writers.Shared.

Maybe we should add something to the docstring of lookupMeta, like:

see also the lookupMeta* functions in @Text.Pandoc.Writers.Shared@

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.

2 participants