Infix declaration: digit or integer?

Björn Peemöller bjp at informatik.uni-kiel.de
Thu Aug 7 13:16:00 UTC 2014


Hello Haskell-Prime,

I just discovered that the Haskell 2010 report allows the precedence of
infix declarations to be an integer instead of just a digit. Therefore,
also the following declarations are allowed:

    -- compiles
    infix 0x7 <$>
    infix 0o7 <$>

    -- does not compile because of precedence out of range
    infix 0xa <$>
    infix 0oa <$>
    infix 123 <$>

Interestingly, the in section 4.4.2 (Fixity Declarations) the report says:

> The *integer* in a fixity declaration must be in the range 0 to 9.

as well as

> If the *digit* is omitted, level 9 is assumed.

This is of course no problem, I'm just curious if there is some
motivation for integer I'm not aware of.

Kind Regards,
Björn






More information about the Haskell-prime mailing list