
3 Oct
2013
3 Oct
'13
12:34 a.m.
I use lenses for almost all of my code, now, in particular the ‘lens’ library due to the tons of syntactic conveniences it provides. The main thing I tend to use ‘lens’ for is actually folds (or traversals), not lenses themselves. I like to construct big folds, restrict them with filters or prisms, take them apart with stuff like ‘splittingOn’ or ‘chunking’, glue them together with combining functions like ‘failing’ or ‘mappend’, and finally read them out with things like ‘preview’, ‘foldrOf’, ‘has’ or ‘elemOf’. My other big use case for lenses is combining them with StateT to write pretty darn imperative-looking code, which is the ‘records’ or ‘lenses’ approach most people are probably more familiar with.
4247
Age (days ago)
4247
Last active (days ago)
0 comments
1 participants
participants (1)
-
Niklas Haas