| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Hs2048.Tile
Description
Types and functions for manipulating tiles.
Documentation
Represents a tile on the game board. Can be empty (Nothing) or can have a
value (Just n). By convention, a tile's value is always a power of 2.
parse :: String -> Tile Source
Parses a string as a tile. This is the inverse of render.
>>>parse "-"Nothing>>>parse "2"Just 2
Calculates the rank of a tile.
>>>rank Nothing0>>>rank (Just 2)1>>>rank (Just 2048)11