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

[F#] Add operators for State<T> #29

Open
chkn opened this issue Jun 23, 2020 · 3 comments
Open

[F#] Add operators for State<T> #29

chkn opened this issue Jun 23, 2020 · 3 comments
Labels
good first issue Good for newcomers lang: F# Specific to the F# API

Comments

@chkn
Copy link
Owner

chkn commented Jun 23, 2020

From the F# perspective, State<T> is just like a ref cell. We should add an F# type extension for State that provides the ! dereference and := assignment operators for it.

@chkn chkn added the good first issue Good for newcomers label Jun 23, 2020
@7sharp9
Copy link

7sharp9 commented Jun 23, 2020

Sounds like a good one to start, ! might be contentious as it might be depreciated: fsharp/fslang-suggestions#569

@chkn
Copy link
Owner Author

chkn commented Jun 23, 2020

Oh interesting! Though that conversation looks like it's been ongoing for years, and the last comment is from over a year ago.

Personally, I think the ! could be more readable. For C#, we can define an implicit conversion from State<T> to T, but for F# you'd basically be stuck writing out .Value everywhere without this.

@7sharp9
Copy link

7sharp9 commented Jun 23, 2020

Yeah I personally dislike not more than ! as seen in the comments. I'll see about adding it to the F# sample just to see what it looks like. Try and get the C#/F# examples vaguely the same too.

@chkn chkn added the lang: F# Specific to the F# API label Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers lang: F# Specific to the F# API
Projects
None yet
Development

No branches or pull requests

2 participants