DEFINE-RECORD for defining single-constructor product types with accessors. #327
chebert
started this conversation in
Ideas and Proposals
Replies: 1 comment 1 reply
-
I also made an experiment of records syntax a couple of days ago: https://gist.github.com/mmontone/990f5731f5dd54973f327c9ceecf3386 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wrote a pair of macros for defining "a poor man's" record type.
I have experienced that being able to have function accessors can make code more concise.
define-record creates a type and generates accessors for that type.
Some Limitations:
A limitation of the accessor functions is that I can update only one field at a time. However, we still have pattern matching, so in that case we can just use a match.
I would prefer that the macros could be used inside of another coalton-toplevel, but I wasn't sure how. Sorry if its obvious and I missed it.
I prefixed type constructor names with an underscore because it helps me avoid name clashes with variables. This may not mesh with coalton's style.
Any thoughts on a record syntax like this or something completely different?
P.S. Haven't forgotten about making a PR for the state monad. Next on my list.
Beta Was this translation helpful? Give feedback.
All reactions