What does the $ operator do?

When reading F # code online, the dollar operator appears over and over again, for example here: Library Templates Multiple levels of abstraction

However, Symbol and Operator Reference simply says "No more information".

What does the operator do and does anyone know where to find the actual documentation on it?

+3


source to share


1 answer


There is no standard operator in the language $

.

You can, of course, define it. This example uses this definition:

let ($) (DF a) (DF b) = DF (fun ctx -> 
  a(ctx)
  b(ctx) )

      

where is DF

defined through:

type Drawing3D = DF of (Drawing3DContext -> unit)

      




In addition, there are special restrictions on the use of a symbol $

in more complex operator names, for example:

let (<$>) f x = List.map f x

      

Compiler error.

error FS0035: This construct is deprecated: '$' is not allowed as a character in operator names and is reserved for future use

+5


source







All Articles