Skip to content

Instantly share code, notes, and snippets.

@jdiez17
Created December 4, 2014 17:29
Show Gist options
  • Save jdiez17/4e026ca854333f9f762b to your computer and use it in GitHub Desktop.
Save jdiez17/4e026ca854333f9f762b to your computer and use it in GitHub Desktop.
╭─jdiez@voidray ~
╰─$ ghci
GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
λ: data Player = Player { health :: Int, name :: String } deriving (Show)
λ: let player = Player 100 "José"
λ: let setHealth p h = p { health = h }
λ: let player' = setHealth player 80
λ: health player
100
λ: health player'
80
λ:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment