@@ -45,14 +45,17 @@ type Input a = { signal : Signal a, handle : Handle a }
4545
4646data Handle a = Handle
4747
48−{-| Create a new `Input`. You just give the initial value for the
49−input’s `signal`.
50−
51−Note for Advanced Users: creating an `Input` is an inherently imperative
52−action, so this is one of very few impure functions in Elm. That means
53−`(input ())` and `(input ())` are actually two different inputs with different
54−signals and handles. By design, Elm’s impure functions can only be useful
55−as you build your signal graph at startup, so Elm is still pure at runtime.
48+{-| This creates a new `Input`. You provide a single argument that will serve
49+as the initial value of the input’s `signal`. For example:
50+
51+ numbers : Input Int
52+ numbers = input 42
53+
54+The initial value of `numbers.signal` is 42, and you will be able
55+to pipe updates to the input using `numbers.handle`.
56+
57+Note: This is an inherently impure function. Specifically, `(input ())` and
58+`(input ())` are actually two different inputs with different signals and handles.
5659-}
5760input : a -> Input a
5861input = Native.Graphics.Input.input
@@ -208,7 +211,7 @@ to match what they have entered.
208211 name = input noContent
209212
210213 nameField : Signal Element
211− nameField = field name.handle (\content -> content) "Name" <~ nameContent
214+ nameField = field name.handle id "Name" <~ name.signal
212215-}
213216field : Handle a -> (FieldContent -> a) -> String -> FieldContent -> Element
214217field = Native.Graphics.Input.field