Added a subOne function (the dual of addOne) to the Types module
This commit is contained in:
parent
cb6fb40440
commit
b603b43b57
|
@ -25,7 +25,7 @@ module Types
|
|||
, returnTypesOfFunction
|
||||
, BytesInResult(..), bytesInType, countReplicator, countStructured, computeStructured
|
||||
|
||||
, makeAbbrevAM, makeConstant, makeDimension, addOne, addExprs, subExprs,
|
||||
, makeAbbrevAM, makeConstant, makeDimension, addOne, subOne, addExprs, subExprs,
|
||||
mulExprs, divExprs
|
||||
, addDimensions, applyDimension, removeFixedDimensions, trivialSubscriptType, subscriptType, unsubscriptType
|
||||
, recordFields, protocolItems
|
||||
|
@ -653,6 +653,11 @@ addOne :: A.Expression -> A.Expression
|
|||
addOne e = A.Dyadic m A.Add (makeConstant m 1) e
|
||||
where m = findMeta e
|
||||
|
||||
-- | Subtrace one from an expression.
|
||||
subOne :: A.Expression -> A.Expression
|
||||
subOne e = A.Dyadic m A.Subtr e (makeConstant m 1)
|
||||
where m = findMeta e
|
||||
|
||||
-- | Add two expressions.
|
||||
addExprs :: A.Expression -> A.Expression -> A.Expression
|
||||
addExprs a b = A.Dyadic m A.Add a b
|
||||
|
|
Loading…
Reference in New Issue
Block a user