How do you define a type for a function in Scala? -


I hope there is a way to define a type for a function in Scala.

For example, say, I have a function that takes two entries and gives a boolean, I can define a function that it uses:

  def checkInts (f: (int, int) => boolean) = {// do stuff}  

Is there any way to define the type of F? Then I can do something like:

  def checkin (f: MyFunctionType)  

or

  def check in (F: option [MyFunctionType])  

  attribute foo {type MyFunction = (Int, int) = & gt; Boolean Df Check In (F: MyFunction) Def Check In (F: Option [MyFunction])}  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -