mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-21 10:41:59 +03:00
35 lines
1.7 KiB
Plaintext
35 lines
1.7 KiB
Plaintext
1/1: Building Test (Test.idr)
|
|
Error: Operator >>= is a regular operator, but is used as an automatically-binding (autobind) operator.
|
|
|
|
Test:10:28--10:31
|
|
06 | (>>) : Monad m => m a -> (a -> m b) -> m b
|
|
07 | (>>) = (>>=)
|
|
08 |
|
|
09 | both : Maybe (Nat, Nat) -> Maybe Nat
|
|
10 | both m = (MkPair x y := m) >>= Just (x + y)
|
|
^^^
|
|
Explanation: regular, typebind and autobind operators all use a slightly different syntax, typebind looks like this: '(name : type) >>= expr', autobind looks like this: '(name := expr) >>= expr'.
|
|
|
|
Possible solutions:
|
|
- Write the expression using regular syntax: 'm >>= Just (x + y)'.
|
|
- Change the fixity defined at Prelude.Ops:20:1--20:37 to 'export autobind infixl 1 >>='.
|
|
- Hide or remove the fixity at Prelude.Ops:20:1--20:37 and import a module that exports a compatible fixity.
|
|
- Did you mean '>>' ?
|
|
1/1: Building Test2 (Test2.idr)
|
|
Error: Operator >>= is a regular operator, but is used as an automatically-binding (autobind) operator.
|
|
|
|
Test2:14:28--14:31
|
|
10 | (>=) : Monad m => m a -> (a -> m b) -> m b
|
|
11 | (>=) = (>>=)
|
|
12 |
|
|
13 | both : Maybe (Nat, Nat) -> Maybe Nat
|
|
14 | both m = (MkPair x y := m) >>= Just (x + y)
|
|
^^^
|
|
Explanation: regular, typebind and autobind operators all use a slightly different syntax, typebind looks like this: '(name : type) >>= expr', autobind looks like this: '(name := expr) >>= expr'.
|
|
|
|
Possible solutions:
|
|
- Write the expression using regular syntax: 'm >>= Just (x + y)'.
|
|
- Change the fixity defined at Prelude.Ops:20:1--20:37 to 'export autobind infixl 1 >>='.
|
|
- Hide or remove the fixity at Prelude.Ops:20:1--20:37 and import a module that exports a compatible fixity.
|
|
- Did you mean either of: '>=', '>>' ?
|