- write (Lens t=:{param,mapw,lens}) p w = read lens (param p) >>= \v->case v of
- Reading s = pure $ Writing $ Lens {t & lens=RWPair s lens}
- Read r = mapw p w r >>= \v->case v of
- Nothing = pure $ Written ()
- Just w = write lens (param p) w >>= \v->case v of
- Writing s = pure $ Writing $ Lens {t & mapw= \_ _ _->pure $ Just w, lens=RWPair (constShare r) s}
- Written _ = pure $ Written ()
+ write (Lens t=:{param,mapw=(LensWriteConst f),lens}) p w = write` lens (param p) (f p w) >>= \v->case v of
+ Writing s = pure $ Writing $ Lens {t & lens=s}
+ Written () = pure $ Written ()
+// write (Lens t=:{param,mapw,lens}) p w = undef/*read lens (param p) >>= \v->case v of
+// Reading s = pure $ Writing $ Lens {t & lens=RWPair s lens}
+// Read r = mapw p w (pure r) >>= \v->case v of
+// Nothing = pure $ Written ()
+// Just w = write lens (param p) w >>= \v->case v of
+// Writing s = pure $ Writing $ Lens {t & mapw= \_ _ _->pure $ Just w, lens=RWPair (constShare r) s}
+// Written _ = pure $ Written ()*/