Added a subOne function (the dual of addOne) to the Types module

This commit is contained in:
Neil Brown 2008-06-06 10:43:30 +00:00
parent cb6fb40440
commit b603b43b57

View File

@ -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