There are no noticeable difference in your case. The fun
keyword is syntactic sugar for val rec
, which makes sure that you can reference the name that you are binding your function to in a recursive manner.
Thus
fun myThunk () = 2 + 2
val rec myThunk = fn () => 2 + 2
val myThunk = fn () => 2 + 2
will all yield the same result.