| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
CardParts.Suits
Description
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 | |
| ToJSON Suit Source # | |
Defined in CardParts.Suits Methods toEncoding :: Suit -> Encoding toJSONList :: [Suit] -> Value toEncodingList :: [Suit] -> Encoding | |
| 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' =RightHeartsparseSuit 'c' =RightClubsparseSuit 'x' =Left"There is no card suit marked asx"