title: How can I change the precision of double value in Haskell?
body: <p>I would like to change the precision of double value.</p>
  
  <p>For example:</p>
  
  <p>I need to get 3.14 from 3.141592653589793</p>
  
  <p>I expect function like:</p>
  
  <pre><code>scale :: Int -&gt; Double -&gt; Double
  &gt; scale 2 3.141592653589793
  3.14
  &gt; scale 3 3.141592653589793
  3.141
  </code></pre>
  
  <p>Also, I would like to be able to choose the rounding strategy.</p>
  
  <pre><code>round :: ROUND -&gt; Int -&gt; Double -&gt; Double
  &gt; round ROUNDUP 5 3.141592653589793
  3.1416
  </code></pre>
  
  <ul>
  <li>How can I do it?</li>
  <li>How can I apply the rounding strategy for it?</li>
  </ul>
  
  <p><strong>P.S.:</strong></p>
  
  <p>Expected behavior in Java should setScale of BigDecimal: <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html</a></p>