I would write the following function able to work with all the numeric types (not only longs):

```
fun nonNegativeDifference(previous: Long, current: Long): Long =
if (previous < current) current - previous
else current
```

Is there a way to write it without to declare all the overloads?

I’ve tried to do the following but this kind of constraint is not supported:

```
fun <T> nonNegativeDifference(previous: T, current: T): T
where T : Comparable<T>,
T : interface { operator fun minus(other: T): T } =
if (previous < current) current - previous
else current
```