Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify implicit arguments for infix operators?

Suppose I have an operator

infixl 9 @@

(@@) : Tensor [S n] t -> Tensor (S n :: tail) t -> Tensor tail t

(where Tensor takes a Vect and a type, but that's not important here). If I want to specify tail, I know that I can add to a @@ b by turning @@ into a function (@@) like

(@@) {tail=[]} a b

but that somewhat defeats the point of it being infix. What's idiomatic?

like image 514
joel Avatar asked Dec 20 '25 09:12

joel


1 Answers

You could try using a postfix projection operator:

(.f) : Tensor [S n] t -> Tensor (S n :: tail) t -> Tensor tail t

a.f {tail=[]} b
like image 191
michaelmesser Avatar answered Dec 24 '25 10:12

michaelmesser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!