-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace (#) with (&) #66
Comments
Idea: make |
How would a |
The closest thing I can think of is instance Transformation ((->) CanvasGradient) Identity CanvasGradient where
grd # f = Identity (f grd) but that would make |
Currently
Here's the trick
Thus
|
I'm a bit confused. What is |
Which means what is grd?
So the |
Ah. So if I'm understanding you correctly, we would (1) create a separate ADT for "member functions" of This sounds pretty promising, but it would break some existing |
How about
This is possible with some trickery. |
You're right. I suppose we could use a similar trick to what |
Right now, we have a function
(#) :: a -> (a -> b) -> b
such thata # f = f a
. It works, but there's been talk of using the(#)
as a natural transformation instead (currently in thewakarusa
repo). With this, we could define natural transformations such as:However, this would not work for things that we currently use the
blank-canvas
(#)
for, such asgrd # addColorStop(0, "#8ED6FF")
and(defFont [sansSerif]) { fontSize = 30 # pt }
. I think the best way to mitigate such a change would be to use the(&) :: a -> (a -> b) -> b
function that was introduced in GHC 7.10 inData.Function
(if one is using an older version of GHC, it's easy to redefine it:a & f = f a
). There's also a bit of history in that(&)
is also used inlens
, so it's not a completely arbitrary choice of name.@andygill, what are your thoughts?
The text was updated successfully, but these errors were encountered: