<div dir="ltr">Like others said, you'll need to install the Decimal package in order to use Data.Decimal.<div><br></div><div>If you really wanted to do it with a floating point type and no dependencies you can use showFFloatAlt from Numeric to display with a specified precision.</div><div><br></div><div>import Numeric</div><div></div><div>import Text.Show</div><div><br></div><div>main = putStrLn . showListWith (showFFloatAlt (Just 2)) [1.00, 1.01 .. 2.00] $ ""</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 17, 2021 at 7:42 PM Galaxy Being <<a href="mailto:borgauf@gmail.com">borgauf@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">As I've said, working at the ghci REPL,<div><br><div>i<font face="monospace">mport Data.Decimal<br>dList :: [Decimal]<br>dList = [1.00,1.01..2.00]<br>main = print dList</font><br></div><div><br></div></div><div>errors out</div><div><br></div><div><font face="monospace">: <interactive>:76:11-17: error:<br>: Not in scope: type constructor or class `Decimal'</font><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 17, 2021 at 8:37 PM Bob Ippolito <<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">You don't need to do any rounding if the list is already Decimal.<div><br></div><div>If you wanted to format a Double with some specific decimal representation you could look at Numeric.showFFloatAlt or similar.</div><div><br></div><div><span style="font-family:monospace">import Data.Decimal</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">dList :: [Decimal]</span><br style="font-family:monospace"><span style="font-family:monospace">dList = [1.00,1.01..2.00]</span></div><div><font face="monospace"><br></font></div><div><font face="monospace">main = print dList<br></font><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 17, 2021 at 5:27 PM Galaxy Being <<a href="mailto:borgauf@gmail.com" target="_blank">borgauf@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm trying to create a list of real numbers with a two-decimal interval, a la <div><br></div><div>> [1.0,1.01,1.02,...1.99,2.00]</div><div><br></div><div>however, I get the float approximation problem</div><div><br></div><div>[1.0,1.01,1.02,1.03,1.04,1.05,1.06,1.07,1.08,1.09,1.1,1.11,1.12,1.1300000000000001,1.1400000000000001,...</div><div><br></div><div>So I attempted to compensate with</div><div><br></div><div>import Data.Decimal<br>map (roundTo 2) [1.00,1.01..2.0]<br></div><div><br></div><div>I don't have to do it this way if there is another rounding function to correct the float overrun issue.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 17, 2021 at 2:43 PM Francesco Ariis <<a href="mailto:fa-ml@ariis.it" target="_blank">fa-ml@ariis.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Il 17 febbraio 2021 alle 14:17 Galaxy Being ha scritto:<br>
> How would I install it globally? I'm not using projects, I'm just at the<br>
> ghci REPL.<br>
<br>
Most likely<br>
<br>
cabal install --lib Decimal<br>
<br>
Check what Tom has said too —F<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>