Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

ramin

By: a guest on May 23rd, 2009  |  syntax: None  |  size: 0.37 KB  |  hits: 49  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. module Chess where
  2.  
  3. data Move = Left | Right | Up | Down deriving (Eq)
  4. type Position = (Char, Int)
  5.  
  6.  
  7. (+) position move
  8.     | move == Chess.Left = ((fst position) Prelude.+ 1, snd position)
  9.     | move == Chess.Right = ((fst position) - 1, snd position)
  10.     | move == Chess.Up = (fst position, (snd position) Prelude.+ 1)
  11.     | move == Chess.Down = (fst position, (snd position) - 1)