'Haskell Lenses: Difference of two HashSets in Folds
Given:
f1, f2 :: Fold Box (HashSet Thing)
how do I write a fold that focuses the Things that are in f1 but not in f2? It would (of course) be the same Box, but f1 and f2 filter its contents differently.
I can see that filtered and hasn't might come into it and HashSet.difference would do the gruntwork, but I can't quite figure out the plumbing.
Solution 1:[1]
It was a silly question. f1 is just a field of Box but f2 is a filter of f1's contents, and the answer would be the converse filter. It's not meaningful to speak of stuffing the answer back into Box, so I don't really want an optic.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Adrian May | 
