# Type parameter, generic

**URL:** https://discuss.kotlinlang.org/t/type-parameter-generic/28014
**Category:** Language Design
**Created:** [January 25, 2024, 8:19am UTC](https://discuss.kotlinlang.org/t/type-parameter-generic/28014 "2024-01-25T08:19:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ValentinDiring](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@ValentinDiring](https://discuss.kotlinlang.org/u/ValentinDiring)
#### Post date: [January 25, 2024, 8:19am UTC](https://discuss.kotlinlang.org/t/type-parameter-generic/28014/1 "2024-01-25T08:19:09Z")

</div>

Hello, is it possible to suppress the type parameter, when you pass it as an type argument to the function?  
The first type parameter is inferred automatically, why i need to pass it with the other type parameter?

```auto
**inline fun <** R: Any**, reified E: Exception> Pair<R?, Exception?>.ex(lambda: Exception.() ->**R**): Triple<R?, Exception?, Boolean> {
    val s = this.second
    return if (s != null && s is E) {
        Triple(s.lambda(), s, true)
    }else Triple(this.first, this.second, false)
}

when apply:
.ex< **String** ,IllegalArgumentException> { "" }**

```

---

<div class="post-metadata">

### Author: ![kyay10](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kyay10](https://discuss.kotlinlang.org/u/kyay10)
#### Post date: [January 25, 2024, 2:15pm UTC](https://discuss.kotlinlang.org/t/type-parameter-generic/28014/2 "2024-01-25T14:15:20Z")

</div>

use an [underscore](https://youtrack.jetbrains.com/issue/KT-30485/Underscore-operator-for-type-arguments):

```auto
.ex<_, IllegalArgumentException> { "" }

```

---

<div class="post-metadata">

### Author: ![ValentinDiring](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@ValentinDiring](https://discuss.kotlinlang.org/u/ValentinDiring)
#### Post date: [January 25, 2024, 4:18pm UTC](https://discuss.kotlinlang.org/t/type-parameter-generic/28014/3 "2024-01-25T16:18:50Z")

</div>

Thank you, it works.
