From b603b43b57d5c2fd72ab676de0fe55d4f175ecac Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 6 Jun 2008 10:43:30 +0000 Subject: [PATCH] Added a subOne function (the dual of addOne) to the Types module --- common/Types.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/Types.hs b/common/Types.hs index 7d4e2d7..830ee4d 100644 --- a/common/Types.hs +++ b/common/Types.hs @@ -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