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

Transform for anonymous structure that has same typed members #1401

Closed
Xyncgas opened this issue Jan 15, 2025 · 2 comments
Closed

Transform for anonymous structure that has same typed members #1401

Xyncgas opened this issue Jan 15, 2025 · 2 comments

Comments

@Xyncgas
Copy link

Xyncgas commented Jan 15, 2025

I suggest implementing a language feature to easily transform anonymous records :

let tranformation_example () =
    let AR =
        struct {|
            R = 0.0f
            G = 1.0f
            B = 2.0f
        |}
    let result = AR |> Ar.map(fun obj -> obj + 1f)
    //alternatively AR |> function obj -> obj + 1f
    /* 
        result =
            struct {|
                R = 1.0f
                G = 2.0f
                B = 3.0f
            |}
    */

Vision : The content inside anonymous record can be recognized by the language for types, since types inside are same, transformation can be applied to structure

@vzarytovskii
Copy link

vzarytovskii commented Jan 15, 2025

Please re-format the suggestion according to the template. With pros, cons, comparing and searching through existing suggestions.

Currently this is not useful since it only covers one shape of the record, with fields of the same type. What you're suggesting are lens, but just worse.

@vzarytovskii
Copy link

I am going to close it, please if still desired, open a new one with proper description and formatting according to the template. Also, consider looking for existing suggestions for lens.

@vzarytovskii vzarytovskii closed this as not planned Won't fix, can't repro, duplicate, stale Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants