-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from diagrams/ht-size
make headSize and tailSize back into ArrowOpts fields
- Loading branch information
Showing
3 changed files
with
16 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this seems to work, in a small test I tried.
I'm not sure whether or not
_Global
is a valid setter, but if it is perhaps thisis the answer to what to do about
headSizeG
and friends.74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What goes in the
...
? I.e. what do you do with constructors likeMaxM
and so on?74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the
Normalized
case doesn't really make sense... applying a function to aNormalized
value and then turning it intoGlobal
is totally bogus. Of course, if we only ever used_Global
for setting (via(.~)
) and not for modifying (via(%~)
) it wouldn't matter, but I still wouldn't feel good about it.74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as what to do with constructors like
MaxM
, I honestly hadn't thought of a solution, I wanted to see if there was some more fundamental problem with the approach first, like "applying a function to aNormalized
value and then turning is into aGlobal
is totally bogus". Can you explain why, i.e. does it violate any lens or functor laws? Or is it simply something like,headSizeG ~* 2
taking a
Normalized
toGlobal
feels like it violates the meaning of multiplication.74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't violate any laws, it's just mixing units. The
Double -> Double
function gets applied indiscriminately toNormalized
andGlobal
andOutput
... values, but the result is interpreted asGlobal
(or whatever). There is no way to meaningfully write aDouble -> Double
function which can take a value measured in any units (without knowing which it is!). Or rather, the only meaningful such functions are constant functions. Your example ofheadSizeG ~* 2
is a good example. TurningGlobal 2
intoGlobal 4
makes good sense. TurningNormalized 0.1
intoGlobal 0.2
is just meaningless.74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, thanks for clarifying.
74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish there was something in
lens
that was truly write, only, i.e. it only let you set and not modify. But I'm not sure that such a thing would have nice properties.74fed72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was think the same. I would be curios what it would look like and what the properties are, but that's a project for another day.