This package defines a datatype (
Unit) and associated
parsing/formatting functions so that command line applications can
handle “nice” values like:
$ cmd create-file foo 100G Done. $ cmd ls-file foo Size is 100Gi $ cmd ls-files foo 100Gi bar 14Ki
And so on. For details on the API, look at the Haddock documentation
For building and installing,
cabal configure and related commands
are enough. Run
cabal configure --enable-tests && cabal build && cabal test if you want to run the unit-tests.
The library is designed to have very few dependencies (only base and a few GHC extensions), so that it’s trivial to use it in projects. Hence the use of some hand-coded conversions instead of using TemplateHaskell to generate them automatically.
The current interface of the library works, but is not nicely composable. I’m still looking for a nicer way to expose the parsing functionality.
Currently, the binary and SI units are mixed in the same data-type. This works, but at some level I think two separate types would be more “correct”, at the expense of a more complex API.
The RationalConvertible type class has only a few instances; ideally
instance Integral a => RationalConvertible a and similar
Fractional, but this doesn’t work as such in Haskell, so we’re
stuck with the manual derivation.
The current behaviour is case-sensitive for all units in
mode, which means that one has to use (in this mode)
Ki for the
Kibi. This seems suboptimal, since the binary units are
unique irrespective of casing.
- Incompatible API change to cleanup some initial design decisions:
the two level
FormatModemodel is removed, the fixed unit of
FormatOptionis moved to a new constructor
FormatOptionis removed entirely. This should be a simpler API, at the cost of breaking compatibility.
- Fixed issue #3 (No support for negative numbers).
- Worked around issue #1 (Add ‘base’ unit) by adding a mode that disables scaling; it should have the same effect without introducing an artificial unit.
- Trivial release for compatibility with QuickCheck 2.7 and older HUnit packages as found in Wheezy.
- The release switches the test suite to use Cabal macros, which might create issues in some cases.
- Fixed issue #2 (Wrong formatting for small numbers in SI mode).
- Trivial release updating upper package bounds (for testing), updating homepage/related settings as part of move to github, and fixing a few documentation issues.
- Initial release.