Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of a # sign in front of a type in a signature (F#)?

Tags:

.net

f#

I have seen the following # sign in some libraries and am not sure what its significance is:

let Compile (e: #Expr)

The Expr is referring to FSharp.Quotations.Expr in this case - not sure if that is relevant.

like image 592
Sam Avatar asked Feb 09 '23 17:02

Sam


1 Answers

#Expr is a shortcut for 'T when 'T :> Expr, which can be read as

some type, which we shall call T for now, which is compatible with type Expr

MSDN has more documentation on Flexible Types.

See also What is the purpose of flexible type annotation in F#? here on Stack Overflow.

like image 105
Jacob Krall Avatar answered Feb 12 '23 15:02

Jacob Krall