Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个Fold (Map k v) (k, v)光学镜。有没有办法通过“光学”库获得它?如果没有,是否有“镜头”?
Fold (Map k v) (k, v)
在optics或lens中,您应该能够编写:
optics
lens
pairs :: Fold (Map k v) (k, v) pairs = folding Map.toList
一般来说,folding采用任何产生可折叠结果的函数(在本例中为键值对列表)并在这些元素上创建折叠。
folding