Skip to content

Instantly share code, notes, and snippets.

@jessitron

jessitron/Box.elm

Created Jul 11, 2015
Embed
What would you like to do?
An Elm type error that took me for a while to understand
module Box (Model, init, Action, update, view) where
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
-- MODEL
type alias Model = ()
init: () -> Model
init _ = ()
-- UPDATE
type Action = Nothing
update : Action -> Model -> Model
update action model = ()
-- VIEW
view : Signal.Address Action -> Model -> Html
view address model =
div []
[
div [ countStyle ] [ text "X" ]
]
countStyle : Attribute
countStyle =
style
[ ("font-size", "20px")
, ("font-family", "monospace")
, ("display", "inline-block")
, ("width", "50px")
, ("text-align", "center")
, ("border", "medium dashed green")
]
module OneBox where
import Box
import StartApp
main = StartApp.start
{ model = Box.init
, update = Box.update
, view = Box.view }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.