Skip to content

List Operators Sorted by Precedence in GHCi

In a large project, it can be difficult to keep track of the precedence of operators. It would be a nice quality-of-life improvement if there were a GHCi command to list the current operators in scope by precedence. It could list them in a table like this:

:operators

| prec | nonassoc | leftassoc | rightassoc |
|------+----------+-----------+------------|
|    9 | !!       |           | .          |
|    8 |          |           | ^ ^^ **    |
|    7 | * /      |           |            |
|    6 | + -      |           |            |
|    5 |          |           | : ++       |
|    4 |          | ==        |            |

Perhaps it could list all infix operators, as well as functions that have a fixity declaration?

Trac metadata
Trac field Value
Version 8.2.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information