I would like to create a record type with a type annotation, with the constraint that the annotation must be a function that returns a certain type. Consider this example below:

```ml
type Foo<'Function> = {
    Function: 'Function
}

```

I would `'Function` to be able to be any function, as long as it returns for example `int`, so that

```
{Function = (fun a b c d e f g -> 2)}
{Function = (fun a -> 2)}

```

work, but

```
{Function = (fun a -> "")}

```

would be invalid.

As far as i understand F# functions, they are a nested structure of tuples, where the most inner second tuple field is the return type of the function, which is the reason why neither of these:

```ml
type Foo<('Input -> int)> = {
    Function: ('Input -> int)
}

type ReturnsInt = FSharpFunc<'Input,int>

```

will work for any function with more than one argument, because the result type is encapsulated in the second annotation in either the signature or `FSharpFunc<_,_>`. Is there a way to realize this as a type annotation?

Edit
----

As Fyodor suggested in the comments below, this can be overcome by using only functions that have tupled arguments, leading to the function annotation being

`FSharpFunc<argumentTuples,ReturnType>`, e.g.:

```ml
type Foo<'ArgumentTuples> = {
    Function: 'ArgumentTuples -> int
}

{Function = (fun (a,b,c,d,e,f,g) -> 2)} // works
{Function = (fun a -> 2)} // works
{Function = (fun a -> "")} // wont work

```

While this approach has its own problems and is not the specific answer to the original question, this workaround/workflow adaptation might be enough for me. I'll leave this question up (can't mark the comment as answer anyways)