2021-12-10 00:18:01 +00:00
|
|
|
module Main exposing (view, view2, view3, badReturnType)
|
2021-09-15 06:07:28 +01:00
|
|
|
|
|
|
|
|
import Html exposing (Html, div, text)
|
|
|
|
|
import Svg exposing (Svg, svg)
|
|
|
|
|
import Array exposing (Array)
|
2021-09-20 07:34:43 +01:00
|
|
|
import Bytes exposing (Bytes)
|
|
|
|
|
import Bytes.Decode
|
|
|
|
|
|
2021-09-15 06:07:28 +01:00
|
|
|
|
|
|
|
|
type alias Model =
|
|
|
|
|
{ a : Int
|
|
|
|
|
, b : Array Int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
view2 : String -> Svg msg
|
|
|
|
|
view2 model =
|
|
|
|
|
svg [] []
|
|
|
|
|
|
|
|
|
|
view : String -> Html msg
|
|
|
|
|
view model =
|
|
|
|
|
div []
|
|
|
|
|
[ text <| "Hello world" ++ model ]
|
2021-09-20 07:34:43 +01:00
|
|
|
|
|
|
|
|
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
|