quantities alternatives and similar packages
Based on the "Data" category.
Alternatively, view quantities alternatives based on common mentions on social networks and blogs.
-
lens
Lenses, Folds, and Traversals - Join us on web.libera.chat #haskell-lens -
semantic-source
Parsing, analyzing, and comparing source code across many languages -
text
Haskell library for space- and time-efficient operations over Unicode text. -
code-builder
Packages for defining APIs, running them, generating client code and documentation. -
unordered-containers
Efficient hashing-based container types -
compendium-client
Mu (μ) is a purely functional framework for building micro services. -
cassava
A CSV parsing and encoding library optimized for ease of use and high performance -
holmes
A reference library for constraint-solving with propagators and CDCL. -
primitive
This package provides various primitive memory-related operations. -
binary
Efficient, pure binary serialisation using ByteStrings in Haskell. -
resource-pool
A high-performance striped resource pooling implementation for Haskell -
discrimination
Fast linear time sorting and discrimination for a large class of data types -
audiovisual
Extensible records, variants, structs, effects, tangles -
dependent-sum
Dependent sums and supporting typeclasses for comparing and displaying them -
IORefCAS
A collection of different packages for CAS based data structures. -
dependent-map
Dependently-typed finite maps (partial dependent products) -
reflection
Reifies arbitrary Haskell terms into types that can be reflected back into terms -
orgmode-parse
Attoparsec parser combinators for parsing org-mode structured text! -
streaming
An optimized general monad transformer for streaming applications, with a simple prelude of functions -
safecopy
An extension to Data.Serialize with built-in version control -
text-icu
This package provides the Haskell Data.Text.ICU library, for performing complex manipulation of Unicode text. -
scientific
Arbitrary-precision floating-point numbers represented using scientific notation -
uuid-types
A Haskell library for creating, printing and parsing UUIDs
TestGPT | Generating meaningful tests for busy devs
Do you think we are missing an alternative of quantities or a related project?
README
Quantities
Unit conversion and manipulation library for Haskell.
Documentation
Check out the docs on Hackage.
Examples
We provide a string-parsing constructor to create quantities. This constructor is built using an expression parser, so arithmetic expressions can be used.
>>> fromString "25 m/s"
Right 25.0 meter / second
>>> fromString "fakeunit"
Left (UndefinedUnitError "fakeunit")
>>> fromString "ft + 12in"
Right 2.0 foot
fromString also supports unit conversions, by placing "=>" in between two valid expressions.
>>> fromString "min => s"
Right 60.0 second
>>> fromString "2 ft + 6 in => ft"
Right 2.5 foot
The convert
function is used for unit conversions.
computation :: Either QuantityError Quantity
computation = do
m <- fromString "30 m"
ft <- units <$> fromString "ft"
convert m ft
>>> computation
Right 98.42519685039369 foot
Executable
An executable is included called quantities
, which is an interface to the
fromString
function.
$ quantities -h
Usage: quantities [-vh] expression
$ quantities "10 bbl/sec => m^3/min"
95.39237695680004 meter ** 3 / minute
$ quantities "fakeunit"
UndefinedUnitError "fakeunit"
What units are defined?
We have already defined an extensive list of units and SI prefixes. To view them, check out this source file.
There is also functionality to modify this file, or create a totally new one.
How to Contribute
Head over to the Github repo to report an issue or create a patch. Also, non-code contributions are always welcome, especially in this early stage of development. That includes, but is not limited to:
- API changes/suggestions
- Code style suggestions
- Unclear documentation
Don't feel shy to raise an issue! Any constructive criticism helps.
TODO
- Handle temperature units. Simple temperature conversions are easy (celsius to farenheit), but compound units with temperatures are tougher.
- Add ability to define units out of order; base quantity does not already have to be defined, as long as it is defined in the file.
- Allow plural form of units. Try to find plural only if no other units can be parsed, or else "ms" will be a plural for meters.
- Allow use of " to " instead of "=>". Because of parser architecture, need to detect either of these tokens before actually parsing units. Otherwise, it will think "to" is a bad unit.