PureScript does not compose `trace` and `show` <p>So the following works</p> <pre><code> main = do trace $ show $ 5 </code></pre> <p>but this does not</p> <pre><code> main = do (trace . show) 5 </code></pre> <p>in psci the type of trace is</p> <pre><code> forall r. Prim.String -&gt; Control.Monad.Eff.Eff (trace :: Debug.Trace.Trace | r) Prelude.Unit </code></pre> <p>and the type of show is</p> <pre><code> forall a. (Prelude.Show a) =&gt; a -&gt; Prim.String </code></pre> <p>since the return value of show is <code>Prim.String</code> and the first input into trace is <code>Prim.String</code> they should be composable. This is further evidenced by that <code>trace $ show</code> passes the type checking. But instead I get this error:</p> <pre><code>Error at line 1, column 10: Error in declaration it Cannot unify Prim.Object with Prim.Function Prim.String. </code></pre> <p>What am I missing here? Right now my mental model is that <code>trace</code> is very like <code>putStrLn</code> in Haskell, and that one can definitely be composed with <code>show</code>. <code>(putStrLn . show) 5</code> works.</p> <p>Expected type of composed result of trace and show:</p> <pre><code> forall a r. (Prelude.Show a) =&gt; a -&gt; Control.Monad.Eff.Eff (trace :: Debug.Trace.Trace | r) Prelude.Unit </code></pre>