
Hello everyone, while I'm playing with fixity declaration in GHCi, I found a strange behavior. Can anyone explain this? Is this actually an expected behavior, or is it a glitch? ---------------------------------------------------------------- $ ghci GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude> minus --(1) <interactive>:1:1: Not in scope: `minus' Prelude> let minus x y = x-y; infixl 6 `minus` --(2) Prelude> 10^5 `minus` 2 --(3) 1000 Prelude> let infixl 6 `minus` --(4) <interactive>:1:14: The fixity declaration for `minus' lacks an accompanying binding Prelude> let subtract x y = x-y --(5) Prelude> 10^5 `subtract` 2 --(6) 1000 Prelude> let f x y = x-y; infixl 6 `f` in 10^5 `f` 2 --(7) 99998 Prelude> ---------------------------------------------------------------- (1) suggests that `minus` is not defined here. in (2), I try to define `minus` with precedence level 6. However, (3) suggests that precedence level of `minus` is stronger than ^ . (4) suggests that you cannot redefine fixity here. (5)(6) is consistent with Haskell 98 report section 4.4.2; "Any operator lacking a fixity declaration is assumed to be infixl 9." in (7), precedence level is set as expected. So, what is happening in (3)? Where did the fixity declaration in (2) went? Best, -- MURANUSHI Takayuki The Hakubi Center, Kyoto University : http://www.hakubi.kyoto-u.ac.jp/