lens / lens-aeson

Traversals and Prisms for Data.Aeson
MIT License
51 stars 18 forks source link

leaf traversals #17

Closed phadej closed 9 years ago

phadej commented 9 years ago

Would it make sense to include:

traverseStrings :: Applicative f => (Text -> f Text) -> Value -> f Value
traverseStrings f = go
  where go (String t)    = String <$> f t
        go (Array arr)   = Array <$> traverse go arr
        go (Object obj)  = Object <$> traverse go obj
        go rest          = pure rest

and similar traverseNumbers and traverseBools, and corresponding Traversal's?

I'm not sure about naming though.

phadej commented 9 years ago

Hmm, traverseStrings seems to be deep _String. I'll make a documentation PR about that.

phadej commented 9 years ago

PR merged: https://github.com/lens/lens-aeson/pull/19

glguy commented 9 years ago

@phadej : Was Terminator Genisys any good?

phadej commented 9 years ago

@glguy, in fact, it wasn't