-
Notifications
You must be signed in to change notification settings - Fork 82
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
feat(Maybe): introduce Maybe #3611
Conversation
c220ffe
to
8d45090
Compare
@GeorgiSTodorov as there are no dependencies to existing code, there's no need to merge master and hassle the CI-Server until discussions are settled. Thanks nonetheless! 😃 |
4887c6b
to
04110fd
Compare
I would vote for Number 1 as it has more developer ergonomity, though we don't get the types inferred :) |
04110fd
to
1aa3488
Compare
It looks like there's some traction on the inference-issue, so let's go with 1. |
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 would like to avoid having Maybe
without everyone fully understand the concept.
Starting from a Monad.
@nLight I don't think that's necessary. Here's why: https://www.youtube.com/watch?v=oYk8CKH7OhE&feature=youtu.be&t=1455 (till ~28:10). TL;DR: the elm docs introduce the concepts of In the past i have felt that introducing stuff like that encourages more sophisticated state and type modelling which in turn makes the work with typescript much easier. While i see that i'm only a very small part of the team and thus the risk of it being introduced and then abandoned seems rather high, i will be owning and spreading this - and i'd throw it out again if we feel that it is not helpful for us. let's try please. 🙏 |
might be in as soon as someone spikes decoders into DCOS-UI. as we settled on the uncurried style to make the most of TS's current inference i'm closing this PR. |
Introduces a Maybe-Type. Have a look at the docs and examples to get a feeling for it.
Besides reading nicer than e.g.
string | undefined
when modelling stuff with types and being a building block for other constructs that aim to push type-safety and -inference as far as possible, the most tangible things for now area way to circumvents checks for undefined
It's a nudge to prevent
?
-properties:Maybe<number>
is rather equivalent toage: number | null
, which currently is rarely used. I suspect because the?
reads better and it's often times less work to just directly pass aroundundefined
s.We have 2 options regarding DX:
Curried, data-last style
pipe
.lodash/fp
andramda.js
Data-first style
I chose to start an own implementation of functional helpers, as
I will rely a lot on stuff i know from elm as i experienced it as being extremely well thought through.