-
Notifications
You must be signed in to change notification settings - Fork 31
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
Create a partially applied record constructor #49
Comments
I realise this is pretty old now, but for this kind of thing I've tended to do things like:
I guess the goal here was to make the applied field order non-specific though? |
Right; so then one doesn't have to worry about argument order. 👍 |
I wonder if this wouldn't be better served by the general purpose "record sequence" feature (that exists somewhere, I'm sure, I just don't remember where off the top of my head).
|
That's a very attractive way to express this problem! |
I think Adam Saleh is the author of this part: https://github.com/justinwoo/purescript-record-extra/blob/685ac456ee8157403b34833d3989754a2ae237ea/src/Record/Extra.purs#L182 |
Labeling as 'documentation' as it seems like the problem was addressed but the solution could be highlighted still. |
It’s still an interesting area generally. See also https://gist.github.com/chrisdone/8ea87b30d3897a031de3ceeec690815e I have a language with row types and I want a way to combine applicative things. I’d love to get a solution that uses the native row types, without stating the same field names twice, and also permitting custom ordering (important for a form). So far I’m not satisfied with any ideas I’ve had. I forgot about this thread. |
Consider this:
This has a problem traditionally that you need to make sure you get the x/y/z order correct. If you're making forms (web forms) with e.g. a formlet library, this becomes pretty hard to manage.
What if we could do this?
(or alternatively by using
SProxy :: SProxy "a"
, etc.)So that
partially F
would produce a function of one argument of one of the x, y or z fields (or more, I guess). When provided with one, it accepts another argument until all fields have been consumed.I made special version of
<*>
that achieves something similar:Which works nicely, but I think re-using
<*>
would be cool too. Any ideas?The text was updated successfully, but these errors were encountered: