
#13996: Non-cheap primop is duplicated -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Conal Elliot [https://mail.haskell.org/pipermail/ghc- devs/2017-July/014407.html writes]: I have {{{ exampleC :: Double -> Double -> Double exampleC = \ t -> let s = sin t in \ x -> x + s }}} But the `sin` ends up being pushed inside the lambda by the optimiser, like so: {{{ exampleC = \ t x -> x + sin t }}} So if I do `map (exampleC v) xs` I end up computing `sin v` once for each element of `xs` rather than once. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13996 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler