Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the ($=) (dollar equals) operator do in Haskell GLUT library?

I was looking through some game code written in Haskell using the GLUT library and this operator keeps popping out everywhere. The worst part is it's completely ungooglable and I can't seem to grep out the definition of it anywhere.

Could someone point out where it is defined and what does it actually do?

("dollar equals" in the title is for future Google'ability)

like image 615
Tomas Avatar asked Apr 05 '11 19:04

Tomas


People also ask

What does the dollar symbol mean in Haskell?

The dollar sign, $ , is a controversial little Haskell operator. Semantically, it doesn't mean much, and its type signature doesn't give you a hint of why it should be used as often as it is. It is best understood not via its type but via its precedence.

What does ++ mean in Haskell?

The ++ operator is the list concatenation operator which takes two lists as operands and "combines" them into a single list.

What does in do in Haskell?

in goes along with let to name one or more local expressions in a pure function.

What does period mean in Haskell?

"The period is a function composition operator. In general terms, where f and g are functions, (f . g) x means the same as f (g x).


1 Answers

It is un-googleable, but not un-hoogleable!

In the StateVar package, the following is defined:

class HasSetter s where -- class of all writable state variables.

($=) :: s a -> a -> IO ()

Write a new value into a state variable.

So it is the 'write' operator for settable (mutable) values. Particularly as used in OpenGL.

like image 98
Don Stewart Avatar answered Oct 14 '22 18:10

Don Stewart