comprehension vs `map'

Simon Peyton-Jones simonpj at microsoft.com
Fri May 15 04:42:06 EDT 2009


should generate the same code!

| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Serge D. Mechveliani
| Sent: 15 May 2009 09:00
| To: glasgow-haskell-users at haskell.org
| Subject: comprehension vs `map'
|
| Dear GHC team,
|
| I would like to write
|              [rl {ruleMode = AlwaysApply} | rl <- rules calc]        (I)
|
| instead of   map (\ rl -> rl {ruleMode = AlwaysApply}) $ rules calc  (II)
| and instead of
|   let rs = rules calc in  [rl {ruleMode = AlwaysApply} | rl <- rs]  (III).
|
| But is this reliable in GHC that the compiler converts (I) into something
| which is not not worse than III ?
| What about other implementations?
|
| Regards,
|
| -----------
| Mechveliani
| mechvel at botik.ru
|
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list