Safe Haskell | None |
---|---|
Language | Haskell2010 |
Card suit data type and its processing functions
Documentation
This type represents card suit.
Instances
Bounded Suit Source # | |
Enum Suit Source # | |
Eq Suit Source # | |
Show Suit Source # | |
Generic Suit Source # | |
FromJSON Suit Source # | |
Defined in CardParts.Suits parseJSON :: Value -> Parser Suit parseJSONList :: Value -> Parser [Suit] | |
ToJSON Suit Source # | |
Defined in CardParts.Suits | |
type Rep Suit Source # | |
Defined in CardParts.Suits type Rep Suit = D1 ('MetaData "Suit" "CardParts.Suits" "ofc-calc-haskell-0.1.0.0-inplace" 'False) ((C1 ('MetaCons "Hearts" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Diamonds" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Clubs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Spades" 'PrefixI 'False) (U1 :: Type -> Type))) |
parseSuit :: Char -> Either String Suit Source #
This function gets a char which represents card suit
and returns a Suit
wrapped with Right
.
Char should be a lowercase symbol from "hdcs" list.
Otherwise - Left
with err msg returns.
Examples:
parseSuit 'h' =Right
Hearts
parseSuit 'c' =Right
Clubs
parseSuit 'x' =Left
"There is no card suit marked asx
"