-
Notifications
You must be signed in to change notification settings - Fork 3
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
value: add a Maybe[T] type #7
Conversation
f135651
to
b4076c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like ❤️
Aha! Now we can bikeshed about the API. I did this to troll @noncombatant but I haven't convinced myself the API is right yet. Ideas welcome! |
53876cc
to
07acd3a
Compare
d507d7e
to
b9ef178
Compare
I was doubting the need for |
Is there an example that would be helpful for clarifying that to future readers? I could add it to the examples file. |
a77ab0e
to
6a18b0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some bikeshedding for your consideration. To repeat what I say in some of the comments, all these are very weakly held opinions and suggestions, mostly just pointing out where I felt friction reading the API, and throwing out some ideas to see if anything useful sticks. Feel free to ignore all of it, and paint the bikeshed in your preferred hue.
Thanks! Some very thoughtful suggestions, most of which I took. 🙂 |
A few more thoughts, but 👍 generally. I'm still not sure how this would feel to wield in actual code, but short of committing it to mds/exp/maybe or something, I don't know how to resolve that short of just seeing what happens and having relaxed views on compatibility 🤷 |
I've resisted being too strict about it, though now that there are more dependents outside my own work I might have to revise that a bit. But I chose a module name that is pretty easy to grep for, and I don't mind sending fixes directly, so for now I'm not going to fret too much, especially for a new package. That said, I would like to play with it some more. I have a few usage patterns in mind:
But mostly this was an essay in the API, I don't have an in-anger need for it yet. |
d71d210
to
3b59cc3
Compare
A Maybe[T] is a container for an optional single value of arbirary type, which may be either present or absent. There are several more interesting things we could do with this type, but for now this is just the basics.
3b59cc3
to
021fe94
Compare
I have removed a couple of the top-level helpers that I wasn't convinced are necessary yet, and I'm going to go ahead and merge the basic type plumbing. |
A Maybe[T] is a container for an optional single value of arbirary type, which
may be either present or absent.
This implementation does not include more general utility functions using the
type (yet). I will add those as experience demands.