Copyright | disco team and contributors |
---|---|
Maintainer | byorgey@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Unary and binary operators along with information like precedence, fixity, and concrete syntax.
Operators
Unary operators.
Instances
Data UOp Source # | |
Defined in Disco.Syntax.Operators gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UOp -> c UOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UOp # dataTypeOf :: UOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UOp) # gmapT :: (forall b. Data b => b -> b) -> UOp -> UOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UOp -> r # gmapQ :: (forall d. Data d => d -> u) -> UOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UOp -> m UOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UOp -> m UOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UOp -> m UOp # | |
Generic UOp Source # | |
Read UOp Source # | |
Show UOp Source # | |
Pretty UOp Source # | Pretty-print a unary operator, by looking up its concrete syntax
in the |
Eq UOp Source # | |
Ord UOp Source # | |
Alpha UOp Source # | |
Defined in Disco.Syntax.Operators aeq' :: AlphaCtx -> UOp -> UOp -> Bool # fvAny' :: (Contravariant f, Applicative f) => AlphaCtx -> (AnyName -> f AnyName) -> UOp -> f UOp # close :: AlphaCtx -> NamePatFind -> UOp -> UOp # open :: AlphaCtx -> NthPatFind -> UOp -> UOp # isPat :: UOp -> DisjointSet AnyName # nthPatFind :: UOp -> NthPatFind # namePatFind :: UOp -> NamePatFind # swaps' :: AlphaCtx -> Perm AnyName -> UOp -> UOp # lfreshen' :: LFresh m => AlphaCtx -> UOp -> (UOp -> Perm AnyName -> m b) -> m b # freshen' :: Fresh m => AlphaCtx -> UOp -> m (UOp, Perm AnyName) # | |
Subst t UOp Source # | |
type Rep UOp Source # | |
Defined in Disco.Syntax.Operators |
Binary operators.
Add | Addition ( |
Sub | Subtraction ( |
SSub | Saturating Subtraction ( |
Mul | Multiplication ( |
Div | Division ( |
Exp | Exponentiation ( |
IDiv | Integer division ( |
Eq | Equality test ( |
Neq | Not-equal ( |
Lt | Less than ( |
Gt | Greater than ( |
Leq | Less than or equal ( |
Geq | Greater than or equal ( |
Min | Minimum ( |
Max | Maximum ( |
And | Logical and ( |
Or | Logical or ( |
Impl | Logical implies ( |
Iff | Logical biconditional ( |
Mod | Modulo ( |
Divides | Divisibility test ( |
Choose | Binomial and multinomial coefficients ( |
Cons | List cons ( |
CartProd | Cartesian product of sets ( |
Union | Union of two sets ( |
Inter | Intersection of two sets ( |
Diff | Difference between two sets (@@) |
Elem | Element test ( |
Subset | Subset test ( |
ShouldEq | Equality assertion ( |
ShouldLt | Less than assertion ( |
Instances
Data BOp Source # | |
Defined in Disco.Syntax.Operators gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BOp -> c BOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BOp # dataTypeOf :: BOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BOp) # gmapT :: (forall b. Data b => b -> b) -> BOp -> BOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BOp -> r # gmapQ :: (forall d. Data d => d -> u) -> BOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> BOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BOp -> m BOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BOp -> m BOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BOp -> m BOp # | |
Generic BOp Source # | |
Read BOp Source # | |
Show BOp Source # | |
Pretty BOp Source # | Pretty-print a binary operator, by looking up its concrete syntax
in the |
Eq BOp Source # | |
Ord BOp Source # | |
Alpha BOp Source # | |
Defined in Disco.Syntax.Operators aeq' :: AlphaCtx -> BOp -> BOp -> Bool # fvAny' :: (Contravariant f, Applicative f) => AlphaCtx -> (AnyName -> f AnyName) -> BOp -> f BOp # close :: AlphaCtx -> NamePatFind -> BOp -> BOp # open :: AlphaCtx -> NthPatFind -> BOp -> BOp # isPat :: BOp -> DisjointSet AnyName # nthPatFind :: BOp -> NthPatFind # namePatFind :: BOp -> NamePatFind # swaps' :: AlphaCtx -> Perm AnyName -> BOp -> BOp # lfreshen' :: LFresh m => AlphaCtx -> BOp -> (BOp -> Perm AnyName -> m b) -> m b # freshen' :: Fresh m => AlphaCtx -> BOp -> m (BOp, Perm AnyName) # | |
Subst t BOp Source # | |
type Rep BOp Source # | |
Defined in Disco.Syntax.Operators type Rep BOp = D1 ('MetaData "BOp" "Disco.Syntax.Operators" "disco-0.1.6-4H4WbJGKK2PJTBCPs5wYLr" 'False) ((((C1 ('MetaCons "Add" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Sub" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SSub" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Mul" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Div" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Exp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IDiv" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "Eq" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Neq" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Lt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Gt" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Leq" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Geq" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Min" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Max" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: ((((C1 ('MetaCons "And" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Or" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Impl" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Iff" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Mod" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Divides" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Choose" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Cons" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "CartProd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Union" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Inter" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Diff" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Elem" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Subset" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ShouldEq" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ShouldLt" 'PrefixI 'False) (U1 :: Type -> Type)))))) |
Type operators.
Instances
Data TyOp Source # | |
Defined in Disco.Syntax.Operators gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyOp -> c TyOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyOp # dataTypeOf :: TyOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyOp) # gmapT :: (forall b. Data b => b -> b) -> TyOp -> TyOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyOp -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyOp -> r # gmapQ :: (forall d. Data d => d -> u) -> TyOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyOp -> m TyOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyOp -> m TyOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyOp -> m TyOp # | |
Generic TyOp Source # | |
Show TyOp Source # | |
Pretty TyOp Source # | |
Eq TyOp Source # | |
Ord TyOp Source # | |
Alpha TyOp Source # | |
Defined in Disco.Syntax.Operators aeq' :: AlphaCtx -> TyOp -> TyOp -> Bool # fvAny' :: (Contravariant f, Applicative f) => AlphaCtx -> (AnyName -> f AnyName) -> TyOp -> f TyOp # close :: AlphaCtx -> NamePatFind -> TyOp -> TyOp # open :: AlphaCtx -> NthPatFind -> TyOp -> TyOp # isPat :: TyOp -> DisjointSet AnyName # nthPatFind :: TyOp -> NthPatFind # namePatFind :: TyOp -> NamePatFind # swaps' :: AlphaCtx -> Perm AnyName -> TyOp -> TyOp # lfreshen' :: LFresh m => AlphaCtx -> TyOp -> (TyOp -> Perm AnyName -> m b) -> m b # freshen' :: Fresh m => AlphaCtx -> TyOp -> m (TyOp, Perm AnyName) # | |
Subst t TyOp Source # | |
type Rep TyOp Source # | |
Operator info
Fixities of unary operators (either pre- or postfix).
Instances
Bounded UFixity Source # | |
Enum UFixity Source # | |
Generic UFixity Source # | |
Show UFixity Source # | |
Eq UFixity Source # | |
Ord UFixity Source # | |
type Rep UFixity Source # | |
Fixity/associativity of infix binary operators (either left, right, or non-associative).
Instances
Bounded BFixity Source # | |
Enum BFixity Source # | |
Generic BFixity Source # | |
Show BFixity Source # | |
Eq BFixity Source # | |
Ord BFixity Source # | |
type Rep BFixity Source # | |
Defined in Disco.Syntax.Operators |
Operators together with their fixity.
Instances
Generic OpFixity Source # | |
Show OpFixity Source # | |
Eq OpFixity Source # | |
type Rep OpFixity Source # | |
Defined in Disco.Syntax.Operators type Rep OpFixity = D1 ('MetaData "OpFixity" "Disco.Syntax.Operators" "disco-0.1.6-4H4WbJGKK2PJTBCPs5wYLr" 'False) (C1 ('MetaCons "UOpF" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UFixity) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UOp)) :+: C1 ('MetaCons "BOpF" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BFixity) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BOp))) |
An OpInfo
record contains information about an operator, such
as the operator itself, its fixity, a list of concrete syntax
representations, and a numeric precedence level.
Operator tables and lookup
opTable :: [[OpInfo]] Source #
The opTable
lists all the operators in the language, in order
of precedence (highest precedence first). Operators in the same
list have the same precedence. This table is used by both the
parser and the pretty-printer.
bopMap :: Map BOp OpInfo Source #
A map from all binary operators to their associatied OpInfo
records.
A convenient function for looking up the precedence of a unary operator.
A convenient function for looking up the precedence of a binary operator.