numerals: Utilities for working with numerals

[ bsd3, library, natural-language-processing, numerical, text ] [ Propose Tags ]

[Skip to Readme]
Versions 0.1, 0.3,, 0.4, 0.4.1
Dependencies base (>=2), bytestring (>=0.9 && <1), dstring (<0.3), mtl (==1.1.*), pretty (>=1 && <1.1), text (==0.1.*) [details]
License BSD-3-Clause
Copyright (c) 2009 Roel van Dijk, Bas van Dijk
Author Roel van Dijk <>, Bas van Dijk <>
Maintainer Roel van Dijk <>, Bas van Dijk <>
Category Natural Language Processing, Numerical, Text
Uploaded by RoelVanDijk at Sun Apr 19 18:38:54 UTC 2009
Distributions NixOS:0.4.1
Downloads 1801 total (12 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI





Specialise the polymorphic language definitions to some often used types (String, ByteString, DString). Note that this increases compilation time and the size of the object files significantly. Also see README


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for numerals-0.1

[back to package description]

This is a small note on the Specialise flag.

All the language definitions (Text.Numeral.Language.*) are polymorphic
in their stringlike type. For example:

> nl :: (IsString s, Joinable s) => NumConfig s

This allows the user to choose whatever stringlike type she wants.

If you turn on the Specialise flag then specialised versions of the
language definitions will be build:

> import qualified Data.ByteString as B
> import qualified Data.DString    as DS
> {-# SPECIALISE nl :: NumConfig String #-}
> {-# SPECIALISE nl :: NumConfig B.ByteString #-}
> {-# SPECIALISE nl :: NumConfig DS.DString #-}
> #endif

The idea is that user code which uses any of the specialised types
will become more efficient because the overloading overhead has been
removed. Of course if we specialise the library will take longer to
compile and will be bigger.

The following will discuss some actual numbers:

Without Specialise

$ cabal configure

$ time cabal build

$ du -b dist/build/libHSnumerals-0.1.a
605574	dist/build/libHSnumerals-0.1.a

With Specialise

$ cabal configure --flags="Specialise"

$ time cabal build

$ du -b dist/build/libHSnumerals-0.1.a
2064852	dist/build/libHSnumerals-0.1.a


If we specialise then:
* compilation will take almost 3 times longer
* the library will be at least 3 times bigger

TODO: Check for peformance gains!