434569 (2) [Avatar] Offline
#1
Both listings, namely
setDifficulty : Nat -> GameState -> GameState
setDifficulty newDiff (MkGameState score _) = MkGameState score newDiff

and
setDifficulty : Nat -> GameState -> GameState
setDifficulty newDiff state = record { difficulty = newDiff } state

results in a type error as GameState is defined as
record GameState where
       constructor MkGameScore
       score : Score
       difficulty : Int

in Listing 12.21 where the difficulty is an Int and not a Nat.