Created
May 12, 2018 03:35
-
-
Save russmatney/aa17ebbaf0c0435062d50ed20eb92a34 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
setExamples :: IO () | |
setExamples = do | |
let bob = User (UserName "bob") 0 Nothing HM.empty | |
print "Bob, with an updated score" | |
print $ set score 42 bob | |
-- User {_userName = UserName "bob", _userScore = 42, _userPet = Nothing, _userInventory = fromList []} | |
print $ (score .~ 42) bob | |
-- User {_userName = UserName "bob", _userScore = 42, _userPet = Nothing, _userInventory = fromList []} | |
-- print bob with score set to 42 | |
print $ bob & score .~ 42 | |
-- User {_userName = UserName "bob", _userScore = 42, _userPet = Nothing, _userInventory = fromList []} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment