on master help sign in
Merge remote-tracking branch 'evan/dev' into webgl
commit22001fa6cd5141fd273442a70f204185bc7d01ec authorJohn P Mayer Jr <john.p.mayer.jr@gmail.com> dateThu 27 Feb 2014, 23:19 (13 years ago) parentb01cf1dcc3c870
2 files changed+12−12
libraries/Graphics/Input.elm+12−9 libraries/Native/Show.js−3
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
libraries/Native/Show.js−3
@@ -6,10 +6,7 @@ Elm.Native.Show.make = function(elm) {
66
77 var NList = Elm.Native.List.make(elm);
88 var List = Elm.List.make(elm);
9− var Maybe = Elm.Maybe.make(elm);
10− var JS = Elm.JavaScript.make(elm);
119 var Dict = Elm.Dict.make(elm);
12− var Json = Elm.Json.make(elm);
1310 var Tuple2 = Elm.Native.Utils.make(elm).Tuple2;
1411
1512 var toString = function(v) {