--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import Html exposing (Html, div, ul, li, text)
type alias Person a =
{ a | name : String
, address : String
}
type alias Employee a =
{ a | department : String }
type alias Customer a =
{ a | itemsPurchased : Int }
changeName : String -> Person a -> Person a
changeName newName person =
{ person | name = newName }
changeDepartment : String -> Employee a -> Employee a
changeDepartment newDepartment employee =
{ employee | department = newDepartment }
changeItemsPurchased : Int -> Customer a -> Customer a
changeItemsPurchased newItemsPurchased customer =
{ customer | itemsPurchased = newItemsPurchased }
main =
let
person = { name="person name", address="person address"}
employee = { name="employee name", address="employee address", department = "employee department" }
customer = { name="customer name", address="customer address", itemsPurchased = 42 }
in
div []
[ ul []
[ renderIt person
, renderIt employee
, renderIt customer
, renderIt (changeName "name changed" person)
, renderIt (changeName "name changed" employee)
, renderIt (changeName "name changed" customer)
-- , renderIt (changchangeDepartmenteName "department changed" person)
, renderIt (changeDepartment "department changed" employee)
-- , renderIt (changeDepartment "department changed" customer)
-- , renderIt (changeItemsPurchased 55 person)
-- , renderIt (changeItemsPurchased 55 employee)
, renderIt (changeItemsPurchased 55 customer)
]
]
renderIt : a -> Html b
renderIt r =
li [] [text (toString r)]
--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/DSXGikv-9ic/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.