Skip to content

Instantly share code, notes, and snippets.

@kadikraman
Created October 20, 2015 11:34
Show Gist options
  • Select an option

  • Save kadikraman/cf8b199dc181001c18f9 to your computer and use it in GitHub Desktop.

Select an option

Save kadikraman/cf8b199dc181001c18f9 to your computer and use it in GitHub Desktop.
Mailboxes in Elm
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
view : Signal.Address String -> String -> Html
view address message =
div []
[ input
[ type' "string",
placeholder "input",
name "points",
on "input" targetValue (\v -> Signal.message address v)
]
[ ],
p [ ] [ text ("Input: " ++ message)]
]
inbox : Signal.Mailbox String
inbox =
Signal.mailbox ""
main : Signal Html
main =
Signal.map (view inbox.address) inbox.signal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment