I'd like to know if it's possible to get GHC to perform some simple CSE for function-level programming. Here's a simple example:<br><br> liftA2 (*) sin sin :: Double -> Double<br><br>which inlines and simplifies to<br>
<br> \ t -> sin t * sin t<br><br>A more realistic, equivalent, example:<br><br> let b = sin <$> id in liftA2 (*) b b<br><br>Can GHC be nudged into computing 'sin t' once rather than twice?<br><br>Thanks, - Conal<br>
<br><br>