0

Is there a way to combine lenses, such that I can apply a function over a and b in the below structure, but not c?

import Control.Lens hiding (element)

data SomeInts = SomeInts {_a :: Int , _b :: Int, _c :: Int  } deriving (Show)
makeLenses ''SomeInts
Carbon
  • 3,828
  • 3
  • 24
  • 51
  • Let me know (@) if the linked question doesn't satisfy you. – dfeuer Sep 23 '17 at 01:48
  • @dfeuer Could a `Traversal` be used for this? It seems they just want to use `over`. – 4castle Sep 23 '17 at 02:38
  • 1
    @4castle, well, they could write a `Traversal`, sure, but they can't combine two lenses in an entirel generic way to get a valid `Traversal`. – dfeuer Sep 23 '17 at 02:42
  • The trouble will be the composition law, which generally objects to visiting the same element twice. – dfeuer Sep 23 '17 at 14:54

0 Answers0