From: Matthijs Kooijman Date: Fri, 13 Feb 2009 08:55:53 +0000 (+0100) Subject: Add a modFunc function to edit a function in the session. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=40ece4d80b50d59c781b9bc157f5379c3a3bb14a;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add a modFunc function to edit a function in the session. --- diff --git a/TranslatorTypes.hs b/TranslatorTypes.hs index 4ced7de..72cd398 100644 --- a/TranslatorTypes.hs +++ b/TranslatorTypes.hs @@ -46,6 +46,12 @@ setFlatFunc hsfunc flatfunc = do let fs'= Map.adjust (\d -> d { flatFunc = Just flatfunc }) hsfunc fs State.modify (\x -> x {funcs = fs' }) +modFunc :: HsFunction -> (HsFunction -> FuncData -> FuncData) -> VHDLState () +modFunc hsfunc f = do + fs <- State.gets funcs -- Get the funcs element from the session + let fs' = Map.adjustWithKey f hsfunc fs + State.modify (\x -> x {funcs = fs' }) + getModule :: VHDLState HscTypes.CoreModule getModule = State.gets coreMod -- Get the coreMod element from the session