Ticket #51 (new enhancement)
optimization of fst . unzip . zip
| Reported by: | choener | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Version: | 0.7 | Keywords: | code-path optimization |
| Cc: | choener@… |
Description
Hi,
lets assume this:
f n = map (\(a,b) -> (a+1,b+1)) . zip (enumFromN 0 n) (enumFromN 0 n) g = fst . unzip main = print . sum . g . f $ 100
In this case i would like to have sum . g . f reduce to sum . enumFromN 0 but this does not happen. Is it in any way possible to get the optimizer to "cut out" unused code paths? The map operation in "f n" is basically a placeholder for something complicated.
If this is possible to optimize correctly, it becomes possible to nicely describe some complicated code paths.
Change History
Note: See
TracTickets for help on using
tickets.
