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

Added Data.RDF.State for easier manipulation of graph with StateT Monad. #112

Merged
merged 1 commit into from
Jun 25, 2021

Conversation

koslambrou
Copy link
Contributor

@koslambrou koslambrou commented Apr 17, 2021

Solves issue #81

Copy link
Contributor

@tmciver tmciver left a comment

Choose a reason for hiding this comment

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

Great work! I really like this idea!

addPrefixMappings
:: (Rdf rdfImpl, Monad m)
=> PrefixMappings
-> Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this Bool maps to the underlying API but I would opt for distinct functions: one to add to existing PrefixMappings (this function) and another to replace the existing ones, say, replacePrefixMappings.

Copy link
Owner

Choose a reason for hiding this comment

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

@koslambrou This suggestion by @tmciver sounds good to me. Thoughts? Either way, haddock documentation to make the functionality clear would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed! I'll change that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also added a comment for each function pointing to the equivalent function in Data.RDF.Types.

-- -- remove one of my interests
-- RDFS.removeTriple triple1
-- @
type RdfST rdfImpl m a = StateT (RDF rdfImpl) m a
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm on the fence about this idea but we might consider using a newtype wrapper here to hide use of StateT.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right! I'll use a newtype instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tmciver Why are you on the fence exactly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Only because it doesn't buy a whole lot other than hiding the use of StateT. I think that's a good idea and I would use a newtype myself but it's hard to justify without a clear benefit. It was more an acknowledgement that not everyone would agree with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just converted to newtype. Is that as expected?

@koslambrou
Copy link
Contributor Author

@tmciver @robstewart57 Any thoughts on the changes?

@tmciver
Copy link
Contributor

tmciver commented May 5, 2021

LGTM!

@robstewart57 robstewart57 merged commit cd6c667 into robstewart57:master Jun 25, 2021
@robstewart57
Copy link
Owner

@koslambrou LGTM also.

Thanks very much! Merged.

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.

3 participants