Haskell code for general game playing