Skip to content

Instantly share code, notes, and snippets.

@Zeroto
Created March 3, 2016 19:26
Show Gist options
  • Save Zeroto/d9a4d4af55e0007af61d to your computer and use it in GitHub Desktop.
Save Zeroto/d9a4d4af55e0007af61d to your computer and use it in GitHub Desktop.
import Html exposing (..)
import Html.Events exposing (onClick)
type alias F = Int -> Int
mailbox = Signal.mailbox identity
view address value = div [] [ text <| toString value
, button [onClick address ((+) 1)] [text "+"]
, button [onClick address ((-) 1)] [text "-"]
]
updates = Signal.foldp (<|) 0 mailbox.signal
main = Signal.map (view mailbox.address) updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment