numerals: Utilities for working with numerals

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

Flags

Automatic Flags
NameDescriptionDefault
specialise

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

Disabled

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

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.3, 0.3.0.1, 0.4, 0.4.1
Dependencies base (>=2), bytestring (>=0.9 && <1), dstring (<0.3), mtl (>=1.1 && <1.2), pretty (>=1 && <1.1), text (>=0.1 && <0.2) [details]
License BSD-3-Clause
Copyright (c) 2009 Roel van Dijk, Bas van Dijk
Author Roel van Dijk <vandijk.roel@gmail.com>, Bas van Dijk <v.dijk.bas@gmail.com>
Maintainer Roel van Dijk <vandijk.roel@gmail.com>, Bas van Dijk <v.dijk.bas@gmail.com>
Category Natural Language Processing, Numerical, Text
Uploaded by RoelVanDijk at 2009-04-19T18:38:54Z
Distributions NixOS:0.4.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4362 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for numerals-0.1

[back to package description]
Specialise
==========

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:

> #ifdef DO_SPECIALISE
> 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
...
5.347s

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


With Specialise
===============

$ cabal configure --flags="Specialise"

$ time cabal build
...
14.779s

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


Conclusion
=========

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!