#readwise
# Full Deck

## Metadata
- Author: [[Mark Seemann]]
- Full Title: Full Deck
- URL: https://blog.ploeh.dk/2018/10/08/full-deck/
## Highlights
- While the mechanics of applicative functors translate well to F#, it leaves you with at least one problem. If you add the above operator `<*>`, you've now 'used up' that operator for lists. While you *can* define an operator of the same name for e.g. `option`, you'd have to put them in separate modules or namespaces in order to prevent them from colliding. This also means that you can't easily use them together. ([View Highlight](https://read.readwise.io/read/01gvste9qxd1n499mkbvcsq2d7))
- Note: FSharpPlus solves this but at a significant development perf cost.
- I wouldn't consider this the most [idiomatic](https://blog.ploeh.dk/2015/08/03/idiomatic-or-idiosyncratic) way to create a full deck of cards in F#. Normally, I'd do this instead:
```fsharp
// Card list
let fullDeck = [
for suit in allSuits do
for face in allFaces do
yield { Face = face; Suit = suit } ]
```
- This alternative syntax takes advantage of F#'s 'extended list comprehension' syntax. FWIW, you could have done something similar in Haskell:
```
fullDeck :: [Card]
fullDeck = [Card f s | f <- allFaces, s <- allSuits]
```
- List comprehension, however, is (as the name implies) specific to lists, whereas an *applicative functor* is a more general concept. ([View Highlight](https://read.readwise.io/read/01gvstgvdjzm6j7p1a4nqzyem3))