ghci> length $ over' mapped id [undefined, undefined]
2
Oops. I'm currently working on adding over', iover', and relatives to lens. The choice I've made over there is not to add a Settable Solo instance, to avoid this very problem. I don't know how these optics work, but the uses of unwrapIdentity' in the Mapping (Star Identity') and Mapping (IxStar Identity') instances look really fishy. What goes wrong if those instances are removed, and over' and iover' are declared to need traversals rather than setters?
Additional surprising uses:
failover' and ifailover' both do things like
if visited
then Just (unwrapIdentity' t)
else Nothing
Should those be like this?
if | visited
, Identity' () v <- t
-> Just v
| otherwise
-> Nothing
or (using Solo)
if | visited
, Solo v <- t
= Just v
| otherwise
= Nothing
While you're in the ballpark, Identity' is quite an awkward type, and there's really no need for such complication.
Identity' ~= Solo -- Best Solo source is OneTuple, which handles all the compat mess
unwrapIdentity' ~= getSolo
wrapIdentity' ~= (Solo $!)
Oops. I'm currently working on adding
over'
,iover'
, and relatives tolens
. The choice I've made over there is not to add aSettable Solo
instance, to avoid this very problem. I don't know how these optics work, but the uses ofunwrapIdentity'
in theMapping (Star Identity')
andMapping (IxStar Identity')
instances look really fishy. What goes wrong if those instances are removed, andover'
andiover'
are declared to need traversals rather than setters?Additional surprising uses:
failover'
andifailover'
both do things likeShould those be like this?
or (using
Solo
)While you're in the ballpark,
Identity'
is quite an awkward type, and there's really no need for such complication.