# Redundant parameter evaluates to ('a -\> 'a) why not just 'a,'b or ('b -\> 'c)?

**URL:** <https://forums.fsharp.org/t/redundant-parameter-evaluates-to-a-a-why-not-just-a-b-or-b-c/2476>\
**Category:** General\
**Created:** [November 11, 2022, 7:46pm UTC](https://forums.fsharp.org/t/redundant-parameter-evaluates-to-a-a-why-not-just-a-b-or-b-c/2476 "2022-11-11T19:46:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrugerX](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/brugerx/32/1111_2.png) [@BrugerX](https://forums.fsharp.org/u/BrugerX)\
**Post date:** [November 11, 2022, 7:46pm UTC](https://forums.fsharp.org/t/redundant-parameter-evaluates-to-a-a-why-not-just-a-b-or-b-c/2476/1 "2022-11-11T19:46:25Z")

</div>

I have defined the following function:

```auto
let rec g2 f h n x =
match n with
|0 -> x
| n -> g2 h f (n-1) (f x);;

```

Running it, I get the type

g2: ('a-\>'a) → ('a-\>'a) → int → 'a → 'a

All of these types make sense to me except for h:

I can see how h can essentially be any type whatsoever, because it isn’t used in g2, which has me wondering why specifically it is a function?

Also, why does it map from ('a → 'a) if it can be any function? Wouldn’t a more general type be mapping from one domain to another? I.g ('b → 'c) rather than from the same to the same?

Of course this question assumes, that F#'s type inference evaluates to the most general type, if this isn’t the case, am I right in assuming ('b → 'c) is more general than ('a → 'a)?

---

<div class="post-metadata">

**Author:** ![ntwilson](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/ntwilson/32/984_2.png) [@ntwilson](https://forums.fsharp.org/u/ntwilson)\
**Post date:** [November 14, 2022, 2:08pm UTC](https://forums.fsharp.org/t/redundant-parameter-evaluates-to-a-a-why-not-just-a-b-or-b-c/2476/2 "2022-11-14T14:08:43Z")

</div>

`h` and `f` have to be the same type, because in your recursive call you flip the order. The definition says `g2 f h ...` and the recursive call says `g2 h f ...`. Since `f` has to be `'a -> 'a`, `h` does too.
