2023-01-19 17:23:38 +00:00
|
|
|
module Main exposing (view, view2, view3, view4, view5, view6, view7, view8, badReturnType, true, main)
|
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
|
|
|
|
|
|
2023-01-19 17:23:38 +00:00
|
|
|
main = text "main"
|
|
|
|
|
|
2021-09-15 06:07:28 +01:00
|
|
|
|
|
|
|
|
type alias Model =
|
|
|
|
|
{ a : Int
|
|
|
|
|
, b : Array Int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
view : String -> Html msg
|
|
|
|
|
view model =
|
|
|
|
|
div []
|
|
|
|
|
[ text <| "Hello world" ++ model ]
|
2021-09-20 07:34:43 +01:00
|
|
|
|
2021-12-11 18:28:04 +00:00
|
|
|
view2 : String -> Svg msg
|
|
|
|
|
view2 model =
|
|
|
|
|
svg [] []
|
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
2021-12-13 04:31:53 +00:00
|
|
|
view4 : String -> Html msg
|
|
|
|
|
view4 model =
|
|
|
|
|
if model == "bar" then
|
|
|
|
|
div []
|
|
|
|
|
[ text <| "Hello world" ++ model ]
|
|
|
|
|
else
|
|
|
|
|
div []
|
|
|
|
|
[ text "Hello world" ]
|
|
|
|
|
|
|
|
|
|
view5 : { t | x : String } -> Html msg
|
|
|
|
|
view5 { x } =
|
|
|
|
|
div []
|
|
|
|
|
[ text x ]
|
|
|
|
|
|
2021-12-29 14:57:35 +00:00
|
|
|
view6 : String -> Html msg
|
|
|
|
|
view6 model =
|
|
|
|
|
let
|
|
|
|
|
f = div []
|
|
|
|
|
in
|
|
|
|
|
f [ text model ]
|
|
|
|
|
|
|
|
|
|
view7 : String -> Html msg
|
|
|
|
|
view7 model =
|
|
|
|
|
(if True then div [] else div []) [ text model ]
|
|
|
|
|
|
|
|
|
|
view8 : String -> Html msg
|
|
|
|
|
view8 model =
|
|
|
|
|
privateFunction [] []
|
|
|
|
|
|
2021-09-20 07:34:43 +01:00
|
|
|
badReturnType : String -> Int
|
|
|
|
|
badReturnType _ =
|
|
|
|
|
42
|
2021-12-13 04:31:53 +00:00
|
|
|
|
2021-12-29 14:57:35 +00:00
|
|
|
privateFunction = div
|
|
|
|
|
|
2021-12-13 04:31:53 +00:00
|
|
|
true : Bool
|
|
|
|
|
true =
|
|
|
|
|
True
|