haskell - UI input with reactive-banana-wx -
how content of ui elements when using reactive-banana? event0 returns event of type event (), has unit type instead of type of control. event1 takes event of type event w (a -> io ()), command of type event w (io ()). mapaccume , mapaccumb takes pure functions parameters, get text foo can't used them.
basically, want work functions instead of data. if you're thinking "how create behavior has current text in box", don't. instead write functions take current text parameter, , pass in when necessary. suppose want print contents of textbox when button pressed. this:
ebutton :: networkdescription (event ()) ebutton = event0 button command network = pressbutton <- ebutton reactimate $ (\() -> text foo >>= print) <$> pressbutton if need input behavior, can use function type behavior (string -> a) (or whatever type need), , pass string in @ point of reactimate call.
Comments
Post a Comment