Skip to content

Instantly share code, notes, and snippets.

@ddellacosta
Last active September 14, 2018 20:23
Show Gist options
  • Save ddellacosta/22d3543daa099f41e25f77be8c681e3d to your computer and use it in GitHub Desktop.
Save ddellacosta/22d3543daa099f41e25f77be8c681e3d to your computer and use it in GitHub Desktop.
data A = A { _af :: B, _bs :: [Int] } deriving Show
data B = B { _bf :: Int, _bs1 :: Char } deriving Show
makeLenses ''A
makeLenses ''B
a = A (B 1 'a') []
-- λ> (over bf (+1) . view af) a
-- B {_bf = 2, _bs1 = 'a'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment