[GHC] #10711: Defining mapM_ in terms of traverse_ causes substantial blow-up in ByteCodeAsm
GHC
ghc-devs at haskell.org
Thu Jul 30 13:56:10 UTC 2015
#10711: Defining mapM_ in terms of traverse_ causes substantial blow-up in
ByteCodeAsm
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner: bgamari
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version:
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case: ghcirun004
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by nomeata):
BTW, here are the relevant definitions that add up to three `>>=` for one
`*>`:
{{{#!hs
a1 *> a2 = (id <$ a1) <*> a2
(<$) = fmap . const
fmap = liftM
liftM f m1 = do { x1 <- m1; return (f x1) } -- here is one
(<*>) = ap
ap m1 m2 = do { x1 <- m1; x2 <- m2; return (x1 x2) } -- here are two
}}}
It seems that performance-worrying code should simply ''not'' implement
`Functor` and `Applicative` via the `Monad`-derived methods.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10711#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list