For example, this does not type check
\cons nil -> 5 `cons` 3 `cons` nil
nor does this
\(#) -> 5 # 3 # nil
Although both of these do
\cons nil -> 5 `cons` nil
\(#) nil -> 5 # nil
Is there a way to assign infixites to operators in lambdas. I tried
infixr 5 #
foo = \(#) nil -> 5 # 3 # nil
which gives an error for no definition of #
and
foo = \(infixr 5 #) nil -> 5 # 3 # nil
which is just a syntax error.
What can I do?
Fixity declarations can be local but must accompany definitions, so you'd have to write something like
foo cons nil = 'a' # 'b' # nil
where (#) = cons
infixr 5 #
or
foo = \cons nil -> let (#) = cons; infixr 5 # in 'a' # 'b' # nil
etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With