module Data.Accessor.Tuple where
import qualified Data.Accessor.Basic as Accessor
first :: Accessor.T (a,b) a
first = Accessor.fromSetGet (\x (_,y) -> (x,y)) fst
second :: Accessor.T (a,b) b
second = Accessor.fromSetGet (\y (x,_) -> (x,y)) snd
first3 :: Accessor.T (a,b,c) a
first3 = Accessor.fromLens $ \(xOld,y,z) -> (xOld, \xNew -> (xNew,y,z))
second3 :: Accessor.T (a,b,c) b
second3 = Accessor.fromLens $ \(x,yOld,z) -> (yOld, \yNew -> (x,yNew,z))
third3 :: Accessor.T (a,b,c) c
third3 = Accessor.fromLens $ \(x,y,zOld) -> (zOld, \zNew -> (x,y,zNew))