on master help sign in
Make docs nicer based on comments on list!

https://groups.google.com/forum/#!topic/elm-discuss/-2bQTi8G1Vg

commitcc3c8704e25a74251d9ac13978806a9f8c2061d0 authorEvan Czaplicki <info@elm-lang.org> dateThu 27 Feb 2014, 17:23 (13 years ago) parentd7e0f25
1 file changed+12−9
libraries/Graphics/Input.elm+12−9
libraries/Graphics/Input.elm+12−9
@@ -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&rsquo;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&rsquo;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&rsquo;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