Unary operators
bwbush opened this issue · 3 comments
bwbush commented
Running agda2hs
on code like
+++_ : Nat → Nat
+++_ x = 2 * x
{-# COMPILE AGDA2HS +++_ #-}
usage : Nat
usage = +++ 5
reports an error
Invalid name for Haskell function: +++_
Is there a way to define unary operators in agda2hs
?
Note that according to the Haskell Wiki, "Unary operators may also be defined and used by the programmer with similar rules to infix operators."
jespercockx commented
Currently this is not supported by agda2hs, though a PR adding support for it would be welcome. (I personally didn't even know that Haskell had unary operators.)
UlfNorell commented
What does the Haskell code look like for the unary operator (I also was not aware of user-defined unary operators in Haskell)?