Agda-2.4.2.2: A dependently typed functional programming language and proof assistant

Safe HaskellNone
LanguageHaskell98

Agda.Syntax.Fixity

Contents

Description

Definitions for fixity, precedence levels, and declared syntax.

Synopsis

Notation coupled with Fixity

data Fixity' Source

The notation is handled as the fixity in the renamer. Hence, they are grouped together in this type.

Constructors

Fixity' 

data NewNotation Source

All the notation information related to a name.

Constructors

NewNotation 

Fields

notaName :: QName

The concrete name the syntax or fixity belongs to.

notaFixity :: Fixity

Associativity and precedence (fixity) of the name.

notation :: Notation

Syntax associated with the name.

oldToNewNotation :: (QName, Fixity') -> NewNotation Source

If an operator has no specific notation, recover it from its name.

notationNames :: NewNotation -> [QName] Source

Return the IdParts of a notation, the first part qualified, the other parts unqualified. This allows for qualified use of operators, e.g., M.for x ∈ xs return e, or x ℕ.+ y.

syntaxOf :: Name -> Notation Source

Create a Notation (without binders) from a concrete Name. Does the obvious thing: Holes become NormalHoles, Ids become IdParts. If Name has no Holes, it returns noNotation.

interestingFixities :: [Fixity'] -> [Fixity'] Source

Removes copies of defaultFixity' from a list of fixities. Never returns an empty list, though, rather a singleton list consisting of defaultFixity'.

chooseFixity :: [Fixity'] -> Fixity' Source

If different interesting fixities are available for the same symbol, we take none of them.

Fixity

defaultFixity :: Fixity Source

The default fixity. Currently defined to be NonAssoc 20.

noFixity :: Fixity Source

Hack used for syntax facility.

Precendence

hiddenArgumentCtx :: Hiding -> Precedence Source

The precedence corresponding to a possibly hidden argument.

opBrackets :: Fixity -> Precedence -> Bool Source

Do we need to bracket an operator application of the given fixity in a context with the given precedence.

lamBrackets :: Precedence -> Bool Source

Does a lambda-like thing (lambda, let or pi) need brackets in the given context? A peculiar thing with lambdas is that they don't need brackets in certain right operand contexts. However, we insert brackets anyway, for the following reasons:

  • Clarity.
  • Sometimes brackets are needed. Example: m₁ >>= (λ x → x) >>= m₂ (here _>>=_ is left associative).

appBrackets :: Precedence -> Bool Source

Does a function application need brackets?

withAppBrackets :: Precedence -> Bool Source

Does a with application need brackets?

piBrackets :: Precedence -> Bool Source

Does a function space need brackets?