agda2hs
agda2hs copied to clipboard
Unary operators
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."
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.)
What does the Haskell code look like for the unary operator (I also was not aware of user-defined unary operators in Haskell)?
Hi @bwbush , what is the expected code this should compile to?