title: Haskell : wrap function
body: <p>Good evening.</p>
  
  <p>Working on a project consisting as building a simple language interpreter, Haskell was choosen because of his functonnality.</p>
  
  <p>My issue is the following. I have a lot of function (&amp; pattern match inside those functions) that actually compute something. I would like to print on screen one parameter (of type Context) at each function application for all my functions.</p>
  
  <p>Exemple :</p>
  
  <pre><code>booleanExpression (And b1 b2) ctx = b1' and b2' 
  booleanExpression (Or b1 b2) ctx = b1' or b2'
  ...
  
  arithmeticExpression (Multiply a1 a2) ctx = a1' * a2'
  ....
  </code></pre>
  
  <p>For those functions I would like to print ctx each time function is called.
  Is there an elegant a simple way to do this ? Or will I must encapsulate each function with something like</p>
  
  <pre><code>arithmeticExpression (Multiply a1 a2) ctx = printAndExec ctx $ a1' * a2'
  </code></pre>
  
  <p>Thank you.</p>