-
Notifications
You must be signed in to change notification settings - Fork 1
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
unjust function? #12
Comments
Thank you very much! It would mean you have a runtime type that you know is of the shape including the Maybes, but you don't know how many of the values are actual |
So here's my use case: In this Writing programs with the generated code, we have received a newtype Rectangle = Rectangle { width :: Maybe Number, height :: Maybe Number } This is protobuf so all fields are optional, but the
If I had an {width, height} :: {width :: Number, height :: Number} <- parseEither $ unjustified (unwrap rectangle) (The I guess if we did this the right way then it would produce one error for each |
This package is really nice and it composes well with https://github.com/xc-jp/purescript-protobuf , because in protobuf messages are mostly records of
Maybe
s, so this package could be useful for message construction.I can also imagine a function
unjustified
which could be useful for message validation, and it would work by turningJust
s into non-Maybe
s, or failing with a message about which fields were missing.Anyway thanks for this package, I linked to it from the protobuf README https://github.com/xc-jp/purescript-protobuf#other-references and I'm thinking that maybe I should feature this package even more prominently in the protobuf docs.
The text was updated successfully, but these errors were encountered: