<div dir="ltr">Thanks for your response. I'm actually already doing you recommended in my library. It does work, but I still think it would be better to have this in base.<div><br></div><div>-Andrew Martin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 3, 2016 at 11:46 AM, Merijn Verstraaten <span dir="ltr"><<a href="mailto:merijn@inconsistent.nl" target="_blank">merijn@inconsistent.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Andrew,<br>
<br>
Data.Fixed actually already provides all the tools you need to support any arbitrary precision. As such, I don't see the need to add obscure precisions to the library in addition to the existing common ones. Using Data.Fixed with a 4 digit precision like you want can be achieved in 3 lines of code in you geolite library. Simply define:<br>
<br>
data MyPrecision<br>
instance HasResolution MyPrecision where<br>
    resolution _ = 4<br>
<br>
and use "Fixed MyPrecision" as type in your library. As you can see in the haddocks, the Num, Real, RealFrac, etc. instances work for any arbitrary instance of HasResolution.<br>
<br>
Cheers,<br>
Merijn<br>
<div><div class="h5"><br>
> On 3 Aug 2016, at 13:57, Andrew Martin <<a href="mailto:andrew.thaddeus@gmail.com">andrew.thaddeus@gmail.com</a>> wrote:<br>
><br>
> I've been working on a library for parsing geolite's GeoIP csv file<br>
> (<a href="http://hackage.haskell.org/package/geolite-csv-0.2/docs/Geolite-Types.html" rel="noreferrer" target="_blank">http://hackage.haskell.org/package/geolite-csv-0.2/docs/Geolite-Types.html</a>).<br>
> In this file, the latitude and longitude are always given to four<br>
> decimal points of precision. It seems like the Fixed data type (from<br>
> Data.Fixed in base) is the best choice for representing this.<br>
><br>
> However, the precision levels provided are:<br>
><br>
> - E0<br>
> - E1<br>
> - E2<br>
> - E3<br>
> - E6<br>
> - E9<br>
> - E12<br>
><br>
> I would like to propose adding all of the missing ones into Data.Fixed<br>
> as well. Even though needed a four-decimal-point-precision number is<br>
> uncommon, it's not unheard of. Admittedly, the precision offered by E11<br>
> seems unlikely to ever be needed, but I think it would be nice for<br>
> completeness. I would be happy to PR this if others agree that it's a<br>
> good idea.<br>
><br>
> -Andrew Martin<br>
><br>
</div></div>> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">-Andrew Thaddeus Martin</div>
</div>