Last active
September 26, 2019 21:34
-
-
Save boombang/cfbb70a69d86dde67d94a425ad7fd94e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lampard = | |
{ name = "Frank" | |
, lastname = "Lampard" | |
, age = 41 | |
} | |
type alias Player = | |
{ name : String | |
, lastname : String | |
, age : Int | |
} | |
gerrard : Player | |
gerrard = | |
{ name = "Steven" | |
, lastname = "Gerrard" | |
, age = 39 | |
} | |
beckham = | |
Player "David" "Beckham" 44 | |
names : List String | |
names = | |
List.map | |
(\player -> player.name) | |
[ lampard, gerrard, beckham ] | |
lastnames : List String | |
lastnames = | |
List.map | |
.lastname | |
[ lampard, gerrard, beckham ] | |
changeName : Player -> String -> Player | |
changeName player name = | |
{ player | name = name } | |
stevenBeckham = | |
changeName beckham "Steven" | |
main = | |
text stevenBeckham.name | |
-- main = | |
-- text (.name stevenBeckham) | |
type alias IsValid = | |
Bool | |
type alias Message = | |
String | |
type alias ValidationResult = | |
( IsValid, Message ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment