Skip to content

Replace (#) with (&) #66

@RyanGlScott

Description

@RyanGlScott

Right now, we have a function (#) :: a -> (a -> b) -> b such that a # f = f a. It works, but there's been talk of using the (#) as a natural transformation instead (currently in the wakarusa repo). With this, we could define natural transformations such as:

instance Transformation Canvas IO DeviceContext where
    (#) = send

However, this would not work for things that we currently use the blank-canvas (#) for, such as grd # 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 in Data.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 in lens, so it's not a completely arbitrary choice of name.

@andygill, what are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions