module Main exposing (main) {-| Sample Elm program — samplefiles.com -} import Html exposing (Html, div, li, p, text, ul) type alias Customer = { id : Int , name : String , balance : Float } isVip : Customer -> Bool isVip customer = customer.balance >= 10000 customers : List Customer customers = [ Customer 1 "Ada" 12500 , Customer 2 "Grace" 830.5 , Customer 3 "Linus" 10000 ] viewCustomer : Customer -> Html msg viewCustomer customer = li [] [ text (customer.name ++ " — " ++ String.fromFloat customer.balance ++ (if isVip customer then " (VIP)" else "" ) ) ] main : Html msg main = div [] [ ul [] (List.map viewCustomer customers) , p [] [ text ("Total: " ++ String.fromFloat (List.sum (List.map .balance customers))) ] ]