starmelon/examples/single-page/src/Main.elm
2025-11-23 19:34:16 -08:00

41 lines
783 B
Elm

module Main exposing (view, view2, view3, badReturnType)
import Html exposing (Html, div, text)
import Svg exposing (Svg, svg)
import Array exposing (Array)
import Bytes exposing (Bytes)
import Bytes.Decode
type alias Model =
{ a : Int
, b : Array Int
}
view : String -> Html msg
view model =
div []
[ text <| "Hello world" ++ model ]
view2 : String -> Svg msg
view2 model =
svg [] []
view3: Bytes -> Html msg
view3 model =
case
Bytes.Decode.decode
(Bytes.Decode.string (Bytes.width model))
model
of
Just decoded ->
div []
[ text <| "Hello world" ++ decoded ]
Nothing ->
text "Failed to decode"
badReturnType : String -> Int
badReturnType _ =
42