Skip to content
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) Syntax for function applications in Record update operations. #455

Open
alissa-tung opened this issue May 14, 2021 · 3 comments
Open

Comments

@alissa-tung
Copy link

Namely, when you try to update a filed using the previous (current) state with a given function f, just write x{it $= f}.

@sdzx-1
Copy link
Collaborator

sdzx-1 commented May 16, 2021

I don't understand what you mean, can you give a more detailed example?

@alissa-tung
Copy link
Author

I don't understand what you mean, can you give a more detailed example?

newtype Rec = MkRec {unRec :: a}
val :: Rec
unRec val :: a

Hence, val{unRec = f $ unRec val}val{unRec $= f}.

@niltok
Copy link
Contributor

niltok commented May 16, 2021

@DotPat notice that record in Hamler is just a kind of map, it comes from Purescript's row polymorphism

and when u define

newtype Rec = MkRec {unRec :: a}

unRec :: Rec -> a is not defined

still, your suggestion is great!!! thx a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants