Safe Haskell | None |
---|---|
Language | Haskell2010 |
Card value data type and its processing functions
Documentation
This type represents card value.
Instances
parseValue :: Char -> ValueResult Source #
This function gets a char which represents card value
and returns a Value
wrapped with Maybe
.
Char should be a digit between 2 and 9 or an uppercase symbol from [AKQJT] list.
Otherwise - Nothing
returns.
Examples:
parseValue '2' =Right
Two
parseValue 'Q' =Right
Queen
parseValue 'z' =Left
"There is no broadway card, which could be represented with 'z'" parseValue '1' =Left
"There is no number card with value 1"