[Haskell-cafe] ANN: engineering-units-0.0.1
Carter Schonwald
carter.schonwald at gmail.com
Tue Mar 11 20:05:42 UTC 2014
neat! Thanks for sharing. Seems like it'll be handy for sanity checking
physics ideas before writing the fancy realizations
On Tue, Mar 11, 2014 at 12:30 PM, Tom Hawkins <tomahawkins at gmail.com> wrote:
> Hi,
>
> I just uploaded a handy library for managing engineering units. It
> provides a Num type that allows you to mix units into calculations. It
> also converts between units automatically and will error out if you try to
> mix values with inconsistent units.
>
> Here's an example that computes the horsepower of a hydraulic pump (power
> = pressure * flow):
>
> flow = 20 * gpm -- Gallons per minute.
> pressure = 3000 * psi -- Pounds per square inch.
> power = pressure * flow
>
> powerHP = value power hp -- Get the value in horsepower.
> powerKW = value power kw -- Get the value in Kilowatts.
>
> If you don't see your units in the library, it's easy to add new ones:
>
> mm :: Value
> mm = 0.001 * m
>
> Wish I had this back in college.
>
> -Tom
>
> http://hackage.haskell.org/package/engineering-units
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140311/efc9c617/attachment-0001.html>
More information about the Haskell-Cafe
mailing list