<div dir="ltr"><div><div class="gmail_extra"><div class="gmail_extra">Thanks for the feedback!</div><div class="gmail_extra"><br></div><div class="gmail_extra">> not sure if "quantities" is an appropriate name for your</div>
<div class="gmail_extra">> package: an integer, a float, complex numbers - those are</div><div class="gmail_extra">> quantities. doesn't this package parse units?</div><div class="gmail_extra"> </div><div class="gmail_extra">
Wikipedia and this dictionary</div><div class="gmail_extra">(<a href="http://dictionary.reference.com/browse/quantity">http://dictionary.reference.com/browse/quantity</a>) imply that</div><div class="gmail_extra">quantities are associated with units of measurement. This package</div>
<div class="gmail_extra">does indeed parse units. When a magnitude is associated with</div><div class="gmail_extra">those units, you get a quantity. I think the name "quantities" is</div><div class="gmail_extra">
totally appropriate.</div><div class="gmail_extra"><br></div><div class="gmail_extra">> why can i only "unsafely" create quantities using strings? what</div><div class="gmail_extra">> if i know upfront what kind of a unit i want to deal with? from</div>
<div class="gmail_extra">> the looks of it, this library is only good for dealing with</div><div class="gmail_extra">> human-readable input - surely that's not the only use case you</div><div class="gmail_extra">
> had in mind?</div><div class="gmail_extra"><br></div><div class="gmail_extra">> can't we find some elegant way to express this in haskell,</div><div class="gmail_extra">> instead of having to invent a scripting language of sorts?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Using the type system to handle units is incorporated into some</div><div class="gmail_extra">other libraries. I couldn't find a library that parses units from</div>
<div class="gmail_extra">strings, so I made one. I certainly plan to add this</div><div class="gmail_extra">functionality in the future.</div><div class="gmail_extra"><br></div><div class="gmail_extra">> On a similar note, your "magnitude :: Quantity -> Double"</div>
<div class="gmail_extra">> sounds a bit like unsafeCoerce: why would you want to forget</div><div class="gmail_extra">> that your quantity has a unit?</div><div class="gmail_extra"><br></div><div class="gmail_extra">
You don't "forget" it has units. Sometimes you just want to get</div><div class="gmail_extra">the magnitude, like after you perform a conversion operation, for</div><div class="gmail_extra">instance.</div><div class="gmail_extra">
<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">> Oh, so you are trying to support arbitrary arithmetical input!</div><div class="gmail_extra">> Then again, there is no way to add two "Quantity"s.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">There is indeed:</div><div class="gmail_extra"><a href="http://hackage.haskell.org/package/quantities-0.3.0/docs/Data-Quantities.html#v:addQuants">http://hackage.haskell.org/package/quantities-0.3.0/docs/Data-Quantities.html#v:addQuants</a></div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">> I have the feeling the goal of your package is a bit unclear:</div><div class="gmail_extra">> do you want to implement a framework to type-safely compute</div>
<div class="gmail_extra">> with units? Or do you just want to write something that parses</div><div class="gmail_extra">> string input to typed data?</div><div class="gmail_extra"><br></div><div class="gmail_extra">
Currently, it parses string input. I am a contributor to a Python</div><div class="gmail_extra">package called pint, which was a huge inspiration to this library.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
In my day job, I develop a commercial Python GUI application for</div><div class="gmail_extra">petroleum engineering that needs to convert between many units.</div><div class="gmail_extra">One feature of this application is a user can enter arbitrary</div>
<div class="gmail_extra">units of their choice to for plots and data so they don't have to</div><div class="gmail_extra">convert units by hand when using the application. I wanted to</div><div class="gmail_extra">bring that functionality to Haskell.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">> Well, that was a big rant, I hope you can use some of it.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I did, thanks!</div></div></div></div>