Prefix type operators in Scala?

35 Views Asked by At

Scala allows writing infix operators for types, just as for expressions:

type ->[P,Q] = P => Q

Making X -> Y equivalent to writing ->[X,Y].

I would like to have a unary prefix operator, but this doesn't seem to work:

type unary_~[P] = ...

Writing ~X causes an error. Of course I can just have type ~[P] = ... and then ~[X] works, but the brackets are not so nice.

0

There are 0 best solutions below