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