setOwner :: File -> User -> File
setOwner f o = f & ownerID .~ (o ^. User.uid)
如何将其转换为Setter
?
我无法将它变成镜头,因为getUser :: UserID -> IO User
是一种不纯的功能。
答案 0 :(得分:1)
我刚刚意识到我之前的回答是错误的。糟糕!
你走了:
ownerS :: Setter File File () User
ownerS = sets (\f file -> setOwner file (f ()))