Created
May 12, 2018 03:38
-
-
Save russmatney/279870df8f143a2ae4a10ab532803182 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
hasGotchaIx :: IO () | |
hasGotchaIx = do | |
let bob = User (UserName "bob") 42 Nothing HM.empty | |
print "Has bob gold in his inventory?" | |
print $ has (inventory . ix "gold") bob | |
-- False | |
let richBob = User (UserName "bob") 42 Nothing | |
$ HM.fromList [("gold", Item 10 10)] | |
print "Has bob gold in his inventory?" | |
print $ has (inventory . ix "gold") richBob | |
-- True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment