Skip to content

Instantly share code, notes, and snippets.

@jessitron
Created July 11, 2015 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessitron/e03f07768c55fe1b922c to your computer and use it in GitHub Desktop.
Save jessitron/e03f07768c55fe1b922c to your computer and use it in GitHub Desktop.
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