Scala complex context bound

44 Views Asked by At

In Scala 2.13 I would like pass a generic parameter of one type OR the another type:

def complex[A : Fractional | Trig]

Like Fractional OR Trig type. Additional complexity is that the types haven't common parent.

I found https://stackoverflow.com/a/29731662/930014 sample with Fractional AND Trig types like:

def complex[A : Fractional : Trig]

But it doesn't suit me because it use AND.

How can I do it?

0

There are 0 best solutions below