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

Order of msg mapping inputs #386

Open
TysonMN opened this issue May 7, 2021 · 1 comment
Open

Order of msg mapping inputs #386

TysonMN opened this issue May 7, 2021 · 1 comment

Comments

@TysonMN
Copy link
Member

TysonMN commented May 7, 2021

The parameter order in the set parameter of Binding.twoWay differs from the parameter order of the function accepted by Binding.mapMsgWithModel.

IIRC, one advantage of the order within Binding.mapMsgWithModel is that it matches what would be needed for that function to be the bind function if Binding<'model, 'msg> were a monad in 'msg (like how 'a -> 'b is a monad in 'b).

@TysonMN
Copy link
Member Author

TysonMN commented Jul 19, 2021

IIRC, one advantage of the order within Binding.mapMsgWithModel is that it matches what would be needed for that function to be the bind function if Binding<'model, 'msg> were a monad in 'msg (like how 'a -> 'b is a monad in 'b).

Nope, I got that backwards; the functions in TwoWayBinding have that advantage.

type internal TwoWayData<'model, 'msg, 'a when 'a : equality> =
{ Get: 'model -> 'a
Set: 'a -> 'model -> 'msg }

Get >> Set : 'model -> 'model -> 'msg

(which is Func.map) and that flattens to just 'model -> 'msg, so

Get |> Func.bind Set : 'model -> 'msg

@TysonMN TysonMN changed the title Binding.twoWay vs Binding.mapMsgWithModel Order of msg mapping inputs Jul 19, 2021
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

1 participant