Is there a way to optimize out some foreign calls?
simonpj at microsoft.com
Mon Apr 10 09:56:18 EDT 2006
| I'm thinking in terms of some way of marking foreign functions to
| how they can be optimized out or specifying rewrite sequences eg
| x >> api_sync >> api_pop >> api_sync >> y = x >> api_pop
| api_sync >> y
You should be able to say something like
api_sync >>= (\_ -> api_pop >>= rest) = api_pop >>= rest
api_pop >>= (\_ -> api_sync >>= rest) = api_pop >>= rest
Do-notation is desugared to (>>=) stuff.
Give it a try on a small example and see if it works
| I've read the manual (7.10) on rewrite rules, but I'm having
| understanding how to express the lhs of the above equation as a
| so that it matches a sequence anywhere in a do block (to deal with
| parentheses and the use of >>= instead of >>)
| Any ideas?
| Thanks, Brian.
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
More information about the Glasgow-haskell-users