john mangual
john mangual

Reputation: 8172

what is the meaning of (=>) = (,)?

In the mouse drag example in Elm have defined (=>) = (,) so that a list is defined this way:

style [ "background-color" => "#67BF46"    , "cursor" => "move" ]

I am more accustomed to:

style [ ( "background-color" , "#67BF46" ) , ( "cursor" , "move" ) ]

are these equivalent? This looks more like a record to me, but not even that.

Upvotes: 0

Views: 74

Answers (1)

Chad Gilbert
Chad Gilbert

Reputation: 36385

Yes, they are equivalent. That library is merely defining an infix function => they deem prettier than using tuple syntax.

Upvotes: 2

Related Questions