From: Matthijs Kooijman Date: Mon, 9 Mar 2009 09:28:24 +0000 (+0100) Subject: Remove nameFlatFunction from the VHDLState monad. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=193c179bc6abf610796b6076aee9f9b557d4b106;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Remove nameFlatFunction from the VHDLState monad. --- diff --git a/Translator.hs b/Translator.hs index 6a78425..c66db94 100644 --- a/Translator.hs +++ b/Translator.hs @@ -91,7 +91,7 @@ moduleToVHDL core list = do mapM addBuiltIn builtin_funcs -- Create entities and architectures for them Monad.zipWithM processBind statefuls binds - modFuncs nameFlatFunction + modFuncMap $ Map.map (\fdata -> fdata {flatFunc = fmap nameFlatFunction (flatFunc fdata)}) modFuncMap $ Map.mapWithKey (\hsfunc fdata -> fdata {funcEntity = VHDL.createEntity hsfunc fdata}) modFuncs VHDL.createArchitecture funcs <- getFuncs @@ -332,21 +332,15 @@ mkHsFunction f ty stateful= -- | Adds signal names to the given FlatFunction nameFlatFunction :: - HsFunction - -> FuncData - -> VHDLState () + FlatFunction + -> FlatFunction -nameFlatFunction hsfunc fdata = - let func = flatFunc fdata in - case func of - -- Skip (builtin) functions without a FlatFunction - Nothing -> do return () - -- Name the signals in all other functions - Just flatfunc -> - let s = flat_sigs flatfunc in - let s' = map nameSignal s in - let flatfunc' = flatfunc { flat_sigs = s' } in - setFlatFunc hsfunc flatfunc' +nameFlatFunction flatfunc = + -- Name the signals + let + s = flat_sigs flatfunc + s' = map nameSignal s in + flatfunc { flat_sigs = s' } where nameSignal :: (SignalId, SignalInfo) -> (SignalId, SignalInfo) nameSignal (id, info) =