From: Matthijs Kooijman Date: Thu, 6 Aug 2009 13:56:23 +0000 (+0200) Subject: Add changeif normalization helper function. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=ee495d5974e55eacc04986df09b732a258f63e6b;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add changeif normalization helper function. --- diff --git "a/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" "b/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" index b26cb74..76fc749 100644 --- "a/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" +++ "b/c\316\273ash/CLasH/Normalize/NormalizeTools.hs" @@ -158,6 +158,12 @@ change val = do setChanged return val +-- Returns the given value and sets the changed flag if the bool given is +-- True. Note that this will not unset the changed flag if the bool is False. +changeif :: Bool -> a -> TransformMonad a +changeif True val = change val +changeif False val = return val + -- Replace each of the binders given with the coresponding expressions in the -- given expression. substitute :: [(CoreBndr, CoreExpr)] -> CoreExpr -> CoreExpr