Basically, you want to work with functions instead of data. If you think, βHow to create a behavior that has the current text in a field,β you donβt. Instead, you write down functions that take the current text as a parameter, and pass it when necessary. Suppose you want to print the contents of a text field when you click a button. Then you would do something like this:
eButton :: NetworkDescription (Event ()) eButton = event0 button command network = do pressButton <- eButton reactimate $ (\() -> get text foo >>= print) <$> pressButton
If you need to introduce input into the behavior, you can similarly use a function with the Behavior (String -> a) type Behavior (String -> a) (or any other type you need), and then just pass the string to the reactimate call reactimate .
source share