4

In Haskell, we can use an infix operator as a parameter name, e.g.:

f :: (Int -> Int -> Int) -> Int
f (|+|) = 3 |+| 4

Is it possible to do something similar in Idris 2? I tried the following:

f : (Int -> Int -> Int) -> Int
f (|+|) = 3 |+| 4

But it fails with:

 Unknown operator '|+|'
 
 slice:2:11--2:18
  1 | f : (Int -> Int -> Int) -> Int
  2 | f (|+|) = 3 |+| 5
                ^^^^^^^
1
  • 1
    do you need to declare it infix first? Commented Jul 26, 2021 at 13:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.