Create a gist now
Instantly share code, notes, and snippets.
HTTPS clone URL
Subversion checkout URL
Attempting to deal some cards.
|type DealerState = State [Card] [[Card]]|
|deck :: [Card]|
|deck = [ (s, r) | s <- suits, r <- ranks ]|
|shuffleDeck :: Int -> RVar [Card]|
|shuffleDeck n = shuffle $ concat $ replicate n deck|
|deal :: Int -> ([[Card]] -> DealerState)|
|deal n = \xs -> state $ \s -> (xs ++ [take n s], drop n s)|
|-- |Deal a number of hands a number of cards each.|
|dealHands :: Int -> Int -> ([[Card]] -> DealerState)|
|dealHands hs cs = foldr1 (<=<) $ replicate hs (deal cs)|