You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Mon, 30 Oct 2017, Heinrich Apfelmus wrote:
That's an interesting suggestion, but I do not quite see the advantage
of using a special monad. It seems to save one keystroke per setter?
For now, I don't know whether the monad solution has an irrefutable
advantage. I am certainly not looking for keystroke savings. I just found
it odd that an attribute setter is an object creation action transformer.
Currently an attribute setter could also do many more things that do not
have to do with attribute setting. E.g. it could generate more objects.
The Access monad would be restricted to attribute manipulation.
The Access monad would also allow you to easily mix getters and setters in
a context:
set width . (2*) =<< get height
Grouping attribute setters currently looks this way:
setA = ...
setB = ...
setC = ...
setAB = setA >=> setB
setAC = setA >=> setC
With the Access monad it would be:
setAB = setA >> setB
setAC = setA >> setC
In the second case I could imagine that GHC is able to share setA between
setAB and setAC, if that is of any relevance.
threepenny
uses this style for setting attributes:Wouldn't it be more natural to have an Access monad:
with
?
It seems to me much more straightforward to bundle setters and getters for re-use, this way.
The text was updated successfully, but these errors were encountered: