haskell-lens

Folding or concatMap-ing an Aeson Array via lenses

天大地大妈咪最大 提交于 2020-08-10 21:22:38
问题 I've been starting at https://www.stackage.org/haddock/lts-12.1/lens-aeson-1.0.2/Data-Aeson-Lens.html and https://www.stackage.org/haddock/lts-12.1/lens-4.16.1/Control-Lens-Fold.html trying to figure out how to write an expression that allows me to construct something of the following type: import Data.Aeson as A functionIWant :: (Vector A.Value) -> (A.Value -> [a]) -> [a] 回答1: There are two lens functions that are used to "lift" regular Foldable -related functions to the lensy world: folded

Folding or concatMap-ing an Aeson Array via lenses

ぐ巨炮叔叔 提交于 2020-08-10 21:19:48
问题 I've been starting at https://www.stackage.org/haddock/lts-12.1/lens-aeson-1.0.2/Data-Aeson-Lens.html and https://www.stackage.org/haddock/lts-12.1/lens-4.16.1/Control-Lens-Fold.html trying to figure out how to write an expression that allows me to construct something of the following type: import Data.Aeson as A functionIWant :: (Vector A.Value) -> (A.Value -> [a]) -> [a] 回答1: There are two lens functions that are used to "lift" regular Foldable -related functions to the lensy world: folded

Folding or concatMap-ing an Aeson Array via lenses

喜夏-厌秋 提交于 2020-08-10 21:19:09
问题 I've been starting at https://www.stackage.org/haddock/lts-12.1/lens-aeson-1.0.2/Data-Aeson-Lens.html and https://www.stackage.org/haddock/lts-12.1/lens-4.16.1/Control-Lens-Fold.html trying to figure out how to write an expression that allows me to construct something of the following type: import Data.Aeson as A functionIWant :: (Vector A.Value) -> (A.Value -> [a]) -> [a] 回答1: There are two lens functions that are used to "lift" regular Foldable -related functions to the lensy world: folded