Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List
- data Pieza = Peon|Caballo|Alfil|Torre|Dama|Rey deriving (Enum,Show)
- data Color = Blanco|Negro deriving (Enum)
- data Trebejo = Trebejo Pieza Color
- data Fila = Uno|Dos|Tres|Cuatro|Cinco|Seis|Siete|Ocho deriving (Enum,Show)
- data Columna = A|B|C|D|E|F|G|H deriving (Enum,Show)
- data Escaque = Escaque Columna Fila
- show1 :: Columna -> Fila -> String
- show1 col fil = ("ABCDEFGH"!!(fromEnum col)):("12345678"!!(fromEnum fil)):[]
- data Ubicacion = Ubicacion Escaque Trebejo
- main :: IO()
- main = putStrLn $ (show1 A Uno)
- $ ghc chess.hs
- [1 of 1] Compiling Main ( chess.hs, chess.o )
- Linking chess ...
- [haroldo@semiosis haskell]$ ./chess
- A1
- [haroldo@semiosis haskell]$
- ;-)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement