Previously, the propagated state was not properly saved, resulting in
stateful functions being defined, while stateless versions were
instantiated.
-- Propagate state variables
let flatfunc' = propagateState hsfunc flatfunc
-- Store the flat function in the session
- modA tsFlatFuncs (Map.insert hsfunc flatfunc)
+ modA tsFlatFuncs (Map.insert hsfunc flatfunc')
-- Flatten any functions used
let used_hsfuncs = Maybe.mapMaybe usedHsFunc (flat_defs flatfunc')
mapM_ resolvFunc used_hsfuncs