Skip to content

Matplotlib should be a Monoid #4

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

Merged
merged 1 commit into from
May 30, 2017
Merged

Matplotlib should be a Monoid #4

merged 1 commit into from
May 30, 2017

Conversation

fhaust
Copy link
Contributor

@fhaust fhaust commented May 30, 2017

This makes it possible to use mconcat and co to combine graphs:

main = do
    onscreen $ mconcat [ axvline x | x <- [1..10] ]

axvline x = mp # "plot.axvline(" # x ## ")"

@abarbu abarbu merged commit 3f5ebdf into abarbu:master May 30, 2017
@abarbu
Copy link
Owner

abarbu commented May 30, 2017

Good idea!

@abarbu
Copy link
Owner

abarbu commented May 30, 2017

Pushed 0.5.0

@fhaust
Copy link
Contributor Author

fhaust commented May 30, 2017 via email

@abarbu
Copy link
Owner

abarbu commented May 30, 2017

The very first version actually had it as a monad. But after using it for a bit I realized that it doesn't really do anything useful as one. I at least don't compose graphs while another computation is running (but maybe others are interested in this?). And I can't really see how it would be useful as a monad transformer.

Maybe if the graph wasn't static this would make much more sense? But even then the monad wouldn't really have any interesting laws or behavior aside from passing the graph around in the background. Can you think of any interesting any monad laws or non-trivial bind for this?

@fhaust
Copy link
Contributor Author

fhaust commented May 30, 2017 via email

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