- func next_phase
- | next_phase == stop_phase
- = case maybe_output_filename of
- Just file -> return file
- Nothing | keep_output -> return persistent
- | otherwise -> newTempName suffix
- -- sometimes, we keep output from intermediate stages
- | otherwise
- = case next_phase of
- Ln -> return persistent
- Mangle | keep_raw_s -> return persistent
- As | keep_s -> return persistent
- HCc | keep_hc -> return persistent
- _other -> newTempName suffix
+ func next_phase maybe_location
+ | is_last_phase, Just f <- maybe_output_filename = return f
+ | is_last_phase && keep_final_output = persistent_fn
+ | keep_this_output = persistent_fn
+ | otherwise = newTempName suffix
+